From 88e76b2a3d7fb9ffc335be332fa42657301aef0f Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Wed, 18 May 2022 14:52:29 +0800 Subject: [PATCH 01/21] feat: add arguments --build-cpu and --build-memory when deploying apps --- src/spring/HISTORY.md | 5 + src/spring/azext_spring/_app_validator.py | 8 + .../azext_spring/_buildservices_factory.py | 12 +- src/spring/azext_spring/_client_factory.py | 5 + src/spring/azext_spring/_help.py | 4 +- src/spring/azext_spring/_params.py | 17 +- src/spring/azext_spring/_utils.py | 2 +- src/spring/azext_spring/app.py | 4 + src/spring/azext_spring/commands.py | 7 +- .../azext_spring/vendored_sdks/__init__.py | 2 +- .../_app_platform_management_client.py | 195 +- .../appplatform/_configuration.py | 4 +- .../aio/_app_platform_management_client.py | 195 +- .../appplatform/aio/_configuration.py | 4 +- .../vendored_sdks/appplatform/models.py | 3 +- .../appplatform/v2020_07_01/__init__.py | 9 +- .../_app_platform_management_client.py | 137 +- .../appplatform/v2020_07_01/_configuration.py | 31 +- .../appplatform/v2020_07_01/_patch.py | 31 + .../appplatform/v2020_07_01/_vendor.py | 27 + .../appplatform/v2020_07_01/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 129 +- .../v2020_07_01/aio/_configuration.py | 18 +- .../appplatform/v2020_07_01/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 488 +- .../aio/operations/_bindings_operations.py | 400 +- .../operations/_certificates_operations.py | 287 +- .../operations/_config_servers_operations.py | 327 +- .../operations/_custom_domains_operations.py | 400 +- .../aio/operations/_deployments_operations.py | 757 +- .../_monitoring_settings_operations.py | 241 +- .../v2020_07_01/aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 656 +- .../aio/operations/_skus_operations.py | 70 +- .../v2020_07_01/models/__init__.py | 209 +- .../_app_platform_management_client_enums.py | 53 +- .../v2020_07_01/models/_models_py3.py | 1318 ++- .../operations/_apps_operations.py | 905 +- .../operations/_bindings_operations.py | 735 +- .../operations/_certificates_operations.py | 524 +- .../operations/_config_servers_operations.py | 582 +- .../operations/_custom_domains_operations.py | 735 +- .../operations/_deployments_operations.py | 1400 ++- .../_monitoring_settings_operations.py | 430 +- .../v2020_07_01/operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1217 ++- .../operations/_skus_operations.py | 118 +- .../v2020_11_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 149 +- .../v2020_11_01_preview/_configuration.py | 31 +- .../appplatform/v2020_11_01_preview/_patch.py | 31 + .../v2020_11_01_preview/_vendor.py | 27 + .../v2020_11_01_preview/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 135 +- .../v2020_11_01_preview/aio/_configuration.py | 18 +- .../v2020_11_01_preview/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 491 +- .../aio/operations/_bindings_operations.py | 400 +- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../operations/_custom_domains_operations.py | 400 +- .../aio/operations/_deployments_operations.py | 763 +- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 656 +- .../aio/operations/_skus_operations.py | 70 +- .../v2020_11_01_preview/models/__init__.py | 212 +- .../_app_platform_management_client_enums.py | 53 +- .../v2020_11_01_preview/models/_models_py3.py | 1365 ++- .../operations/_apps_operations.py | 914 +- .../operations/_bindings_operations.py | 735 +- .../operations/_certificates_operations.py | 527 +- .../operations/_config_servers_operations.py | 591 +- .../operations/_custom_domains_operations.py | 735 +- .../operations/_deployments_operations.py | 1406 ++- .../_monitoring_settings_operations.py | 430 +- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1217 ++- .../operations/_skus_operations.py | 118 +- .../v2021_06_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 149 +- .../v2021_06_01_preview/_configuration.py | 31 +- .../appplatform/v2021_06_01_preview/_patch.py | 31 + .../v2021_06_01_preview/_vendor.py | 27 + .../v2021_06_01_preview/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 135 +- .../v2021_06_01_preview/aio/_configuration.py | 18 +- .../v2021_06_01_preview/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 491 +- .../aio/operations/_bindings_operations.py | 400 +- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../operations/_custom_domains_operations.py | 400 +- .../aio/operations/_deployments_operations.py | 763 +- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 656 +- .../aio/operations/_skus_operations.py | 70 +- .../v2021_06_01_preview/models/__init__.py | 221 +- .../_app_platform_management_client_enums.py | 53 +- .../v2021_06_01_preview/models/_models_py3.py | 1451 ++- .../operations/_apps_operations.py | 914 +- .../operations/_bindings_operations.py | 735 +- .../operations/_certificates_operations.py | 527 +- .../operations/_config_servers_operations.py | 591 +- .../operations/_custom_domains_operations.py | 735 +- .../operations/_deployments_operations.py | 1406 ++- .../_monitoring_settings_operations.py | 430 +- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1217 ++- .../operations/_skus_operations.py | 118 +- .../v2021_09_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 153 +- .../v2021_09_01_preview/_configuration.py | 31 +- .../appplatform/v2021_09_01_preview/_patch.py | 31 + .../v2021_09_01_preview/_vendor.py | 27 + .../v2021_09_01_preview/_version.py | 2 +- .../v2021_09_01_preview/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 139 +- .../v2021_09_01_preview/aio/_configuration.py | 18 +- .../v2021_09_01_preview/aio/_patch.py | 31 + .../aio/operations/_apps_operations.py | 491 +- .../aio/operations/_bindings_operations.py | 400 +- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../operations/_custom_domains_operations.py | 400 +- .../aio/operations/_deployments_operations.py | 1053 ++- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 796 +- .../aio/operations/_skus_operations.py | 70 +- .../aio/operations/_storages_operations.py | 287 +- .../v2021_09_01_preview/models/__init__.py | 264 +- .../_app_platform_management_client_enums.py | 71 +- .../v2021_09_01_preview/models/_models_py3.py | 1718 +++- .../operations/_apps_operations.py | 914 +- .../operations/_bindings_operations.py | 735 +- .../operations/_certificates_operations.py | 527 +- .../operations/_config_servers_operations.py | 591 +- .../operations/_custom_domains_operations.py | 735 +- .../operations/_deployments_operations.py | 1932 ++-- .../_monitoring_settings_operations.py | 430 +- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1465 ++- .../operations/_skus_operations.py | 118 +- .../operations/_storages_operations.py | 524 +- .../v2022_01_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 227 +- .../v2022_01_01_preview/_configuration.py | 31 +- .../appplatform/v2022_01_01_preview/_patch.py | 31 + .../v2022_01_01_preview/_vendor.py | 27 + .../v2022_01_01_preview/aio/__init__.py | 5 + .../aio/_app_platform_management_client.py | 213 +- .../v2022_01_01_preview/aio/_configuration.py | 18 +- .../v2022_01_01_preview/aio/_patch.py | 31 + .../_api_portal_custom_domains_operations.py | 305 +- .../aio/operations/_api_portals_operations.py | 347 +- .../aio/operations/_apps_operations.py | 589 +- .../aio/operations/_bindings_operations.py | 400 +- .../_build_service_agent_pool_operations.py | 235 +- .../_build_service_builder_operations.py | 302 +- .../operations/_build_service_operations.py | 674 +- .../_buildpack_binding_operations.py | 316 +- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../_configuration_services_operations.py | 385 +- .../operations/_custom_domains_operations.py | 400 +- .../aio/operations/_deployments_operations.py | 1053 ++- .../_gateway_custom_domains_operations.py | 305 +- .../_gateway_route_configs_operations.py | 305 +- .../aio/operations/_gateways_operations.py | 347 +- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../_service_registries_operations.py | 270 +- .../aio/operations/_services_operations.py | 796 +- .../aio/operations/_skus_operations.py | 70 +- .../aio/operations/_storages_operations.py | 287 +- .../v2022_01_01_preview/models/__init__.py | 507 +- .../_app_platform_management_client_enums.py | 91 +- .../v2022_01_01_preview/models/_models_py3.py | 2868 ++++-- .../_api_portal_custom_domains_operations.py | 562 +- .../operations/_api_portals_operations.py | 643 +- .../operations/_apps_operations.py | 1084 ++- .../operations/_bindings_operations.py | 735 +- .../_build_service_agent_pool_operations.py | 422 +- .../_build_service_builder_operations.py | 559 +- .../operations/_build_service_operations.py | 1364 ++- .../_buildpack_binding_operations.py | 593 +- .../operations/_certificates_operations.py | 527 +- .../operations/_config_servers_operations.py | 591 +- .../_configuration_services_operations.py | 694 +- .../operations/_custom_domains_operations.py | 735 +- .../operations/_deployments_operations.py | 1932 ++-- .../_gateway_custom_domains_operations.py | 562 +- .../_gateway_route_configs_operations.py | 562 +- .../operations/_gateways_operations.py | 643 +- .../_monitoring_settings_operations.py | 430 +- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../_service_registries_operations.py | 494 +- .../operations/_services_operations.py | 1465 ++- .../operations/_skus_operations.py | 118 +- .../operations/_storages_operations.py | 524 +- .../_app_platform_management_client.py | 14 +- .../v2022_03_01_preview/_configuration.py | 12 +- .../aio/_app_platform_management_client.py | 12 +- .../v2022_03_01_preview/aio/_configuration.py | 12 +- .../_api_portal_custom_domains_operations.py | 71 +- .../aio/operations/_api_portals_operations.py | 81 +- .../aio/operations/_apps_operations.py | 132 +- .../aio/operations/_bindings_operations.py | 90 +- .../_build_service_agent_pool_operations.py | 47 +- .../_build_service_builder_operations.py | 71 +- .../operations/_build_service_operations.py | 150 +- .../_buildpack_binding_operations.py | 71 +- .../operations/_certificates_operations.py | 71 +- .../operations/_config_servers_operations.py | 73 +- .../_configuration_services_operations.py | 90 +- .../operations/_custom_domains_operations.py | 90 +- .../aio/operations/_deployments_operations.py | 260 +- .../_gateway_custom_domains_operations.py | 71 +- .../_gateway_route_configs_operations.py | 71 +- .../aio/operations/_gateways_operations.py | 81 +- .../_monitoring_settings_operations.py | 54 +- .../aio/operations/_operations.py | 18 +- .../_runtime_versions_operations.py | 16 +- .../_service_registries_operations.py | 72 +- .../aio/operations/_services_operations.py | 205 +- .../aio/operations/_skus_operations.py | 18 +- .../aio/operations/_storages_operations.py | 71 +- .../v2022_03_01_preview/models/__init__.py | 4 + .../_app_platform_management_client_enums.py | 12 + .../v2022_03_01_preview/models/_models_py3.py | 26 +- .../_api_portal_custom_domains_operations.py | 159 +- .../operations/_api_portals_operations.py | 191 +- .../operations/_apps_operations.py | 309 +- .../operations/_bindings_operations.py | 200 +- .../_build_service_agent_pool_operations.py | 114 +- .../_build_service_builder_operations.py | 159 +- .../operations/_build_service_operations.py | 427 +- .../_buildpack_binding_operations.py | 159 +- .../operations/_certificates_operations.py | 159 +- .../operations/_config_servers_operations.py | 163 +- .../_configuration_services_operations.py | 200 +- .../operations/_custom_domains_operations.py | 200 +- .../operations/_deployments_operations.py | 545 +- .../_gateway_custom_domains_operations.py | 159 +- .../_gateway_route_configs_operations.py | 159 +- .../operations/_gateways_operations.py | 191 +- .../_monitoring_settings_operations.py | 122 +- .../operations/_operations.py | 39 +- .../_runtime_versions_operations.py | 38 +- .../_service_registries_operations.py | 159 +- .../operations/_services_operations.py | 485 +- .../operations/_skus_operations.py | 41 +- .../operations/_storages_operations.py | 159 +- .../appplatform/v2022_04_01/__init__.py | 18 + .../_app_platform_management_client.py | 153 + .../appplatform/v2022_04_01/_configuration.py | 74 + .../appplatform/v2022_04_01/_patch.py | 31 + .../appplatform/v2022_04_01/_vendor.py | 27 + .../appplatform/v2022_04_01/_version.py | 9 + .../appplatform/v2022_04_01/aio/__init__.py | 15 + .../aio/_app_platform_management_client.py | 153 + .../v2022_04_01/aio/_configuration.py | 73 + .../appplatform/v2022_04_01/aio/_patch.py | 31 + .../v2022_04_01/aio/operations/__init__.py | 45 + .../aio/operations/_apps_operations.py | 852 ++ .../aio/operations/_bindings_operations.py | 606 ++ .../_build_service_agent_pool_operations.py | 346 + .../_build_service_builder_operations.py | 462 + .../operations/_build_service_operations.py | 985 ++ .../_buildpack_binding_operations.py | 483 + .../operations/_certificates_operations.py | 444 + .../operations/_config_servers_operations.py | 492 + .../_configuration_services_operations.py | 578 ++ .../operations/_custom_domains_operations.py | 606 ++ .../aio/operations/_deployments_operations.py | 1504 +++ .../_monitoring_settings_operations.py | 365 + .../v2022_04_01/aio/operations/_operations.py | 115 + .../_runtime_versions_operations.py | 93 + .../_service_registries_operations.py | 430 + .../aio/operations/_services_operations.py | 925 ++ .../aio/operations/_skus_operations.py | 118 + .../v2022_04_01/models/__init__.py | 327 + .../_app_platform_management_client_enums.py | 249 + .../v2022_04_01/models/_models_py3.py | 5766 ++++++++++++ .../v2022_04_01/operations/__init__.py | 45 + .../operations/_apps_operations.py | 1190 +++ .../operations/_bindings_operations.py | 823 ++ .../_build_service_agent_pool_operations.py | 475 + .../_build_service_builder_operations.py | 631 ++ .../operations/_build_service_operations.py | 1506 +++ .../_buildpack_binding_operations.py | 660 ++ .../operations/_certificates_operations.py | 605 ++ .../operations/_config_servers_operations.py | 664 ++ .../_configuration_services_operations.py | 785 ++ .../operations/_custom_domains_operations.py | 823 ++ .../operations/_deployments_operations.py | 2069 +++++ .../_monitoring_settings_operations.py | 493 + .../v2022_04_01/operations/_operations.py | 144 + .../_runtime_versions_operations.py | 122 + .../_service_registries_operations.py | 582 ++ .../operations/_services_operations.py | 1348 +++ .../operations/_skus_operations.py | 153 + .../v2022_05_01_preview/__init__.py | 18 + .../_app_platform_management_client.py | 180 + .../v2022_05_01_preview/_configuration.py | 74 + .../appplatform/v2022_05_01_preview/_patch.py | 31 + .../v2022_05_01_preview/_vendor.py | 27 + .../v2022_05_01_preview/_version.py | 9 + .../v2022_05_01_preview/aio/__init__.py | 15 + .../aio/_app_platform_management_client.py | 177 + .../v2022_05_01_preview/aio/_configuration.py | 73 + .../v2022_05_01_preview/aio/_patch.py | 31 + .../aio/operations/__init__.py | 57 + .../_api_portal_custom_domains_operations.py | 464 + .../aio/operations/_api_portals_operations.py | 512 ++ .../aio/operations/_apps_operations.py | 853 ++ .../aio/operations/_bindings_operations.py | 606 ++ .../_build_service_agent_pool_operations.py | 346 + .../_build_service_builder_operations.py | 462 + .../operations/_build_service_operations.py | 985 ++ .../_buildpack_binding_operations.py | 484 + .../operations/_certificates_operations.py | 445 + .../operations/_config_servers_operations.py | 495 + .../_configuration_services_operations.py | 578 ++ .../operations/_custom_domains_operations.py | 606 ++ .../aio/operations/_deployments_operations.py | 1509 +++ .../_gateway_custom_domains_operations.py | 464 + .../_gateway_route_configs_operations.py | 465 + .../aio/operations/_gateways_operations.py | 512 ++ .../_monitoring_settings_operations.py | 365 + .../aio/operations/_operations.py | 115 + .../_runtime_versions_operations.py | 93 + .../_service_registries_operations.py | 430 + .../aio/operations/_services_operations.py | 1135 +++ .../aio/operations/_skus_operations.py | 118 + .../aio/operations/_storages_operations.py | 444 + .../v2022_05_01_preview/models/__init__.py | 441 + .../_app_platform_management_client_enums.py | 329 + .../v2022_05_01_preview/models/_models_py3.py | 8111 +++++++++++++++++ .../operations/__init__.py | 57 + .../_api_portal_custom_domains_operations.py | 633 ++ .../operations/_api_portals_operations.py | 719 ++ .../operations/_apps_operations.py | 1194 +++ .../operations/_bindings_operations.py | 823 ++ .../_build_service_agent_pool_operations.py | 475 + .../_build_service_builder_operations.py | 631 ++ .../operations/_build_service_operations.py | 1506 +++ .../_buildpack_binding_operations.py | 661 ++ .../operations/_certificates_operations.py | 606 ++ .../operations/_config_servers_operations.py | 667 ++ .../_configuration_services_operations.py | 785 ++ .../operations/_custom_domains_operations.py | 823 ++ .../operations/_deployments_operations.py | 2074 +++++ .../_gateway_custom_domains_operations.py | 633 ++ .../_gateway_route_configs_operations.py | 634 ++ .../operations/_gateways_operations.py | 719 ++ .../_monitoring_settings_operations.py | 493 + .../operations/_operations.py | 144 + .../_runtime_versions_operations.py | 122 + .../_service_registries_operations.py | 582 ++ .../operations/_services_operations.py | 1630 ++++ .../operations/_skus_operations.py | 153 + .../operations/_storages_operations.py | 605 ++ 375 files changed, 122733 insertions(+), 34249 deletions(-) create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py diff --git a/src/spring/HISTORY.md b/src/spring/HISTORY.md index a8714a49097..a8d84c916f2 100644 --- a/src/spring/HISTORY.md +++ b/src/spring/HISTORY.md @@ -1,5 +1,10 @@ Release History =============== +1.1.0 +--- +* Support setting --build-env and --build-momery when deploying apps. +* Exclude mvn version files when uploading source code. + 1.0.0 --- * Initialize extension "Spring" to manage Azure Spring Apps resources. \ No newline at end of file diff --git a/src/spring/azext_spring/_app_validator.py b/src/spring/azext_spring/_app_validator.py index 1a12090f00c..01c2febd01e 100644 --- a/src/spring/azext_spring/_app_validator.py +++ b/src/spring/azext_spring/_app_validator.py @@ -120,10 +120,18 @@ def validate_cpu(namespace): namespace.cpu = validate_cpu_value(namespace.cpu) +def validate_build_cpu(namespace): + namespace.build_cpu = validate_cpu_value(namespace.build_cpu) + + def validate_memory(namespace): namespace.memory = validate_memory_value(namespace.memory) +def validate_build_memory(namespace): + namespace.build_memory = validate_memory_value(namespace.build_memory) + + def _get_app_name_from_namespace(namespace): if hasattr(namespace, 'app'): return namespace.app diff --git a/src/spring/azext_spring/_buildservices_factory.py b/src/spring/azext_spring/_buildservices_factory.py index 88ae2aa4156..ab10446868f 100644 --- a/src/spring/azext_spring/_buildservices_factory.py +++ b/src/spring/azext_spring/_buildservices_factory.py @@ -14,7 +14,7 @@ from msrestazure.tools import parse_resource_id from azure.cli.core.commands.client_factory import get_subscription_id from msrestazure.azure_exceptions import CloudError -from .vendored_sdks.appplatform.v2022_01_01_preview import models +from .vendored_sdks.appplatform.v2022_05_01_preview import models from ._deployment_uploadable_factory import uploader_selector from ._log_stream import LogStream from .vendored_sdks.appplatform.v2022_01_01_preview.models._app_platform_management_client_enums import SupportedRuntimeValue @@ -58,14 +58,20 @@ def _get_upload_info(self): except AttributeError as e: raise AzureInternalError("Failed to get a SAS URL to upload context. Error: {}".format(e)) - def _queue_build(self, relative_path=None, builder=None, build_env=None, app=None, **_): + def _queue_build(self, relative_path=None, builder=None, build_env=None, build_cpu=None, build_memory=None, app=None, **_): subscription = get_subscription_id(self.cmd.cli_ctx) service_resource_id = '/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}'.format(subscription, self.resource_group, self.service) + build_resource_requests = models.BuildResourceRequests( + cpu=build_cpu, + memory=build_memory + ) properties = models.BuildProperties( builder='{}/buildservices/default/builders/{}'.format(service_resource_id, builder), agent_pool='{}/buildservices/default/agentPools/default'.format(service_resource_id), relative_path=relative_path, - env=build_env if build_env else None) + env=build_env if build_env else None, + resource_requests=build_resource_requests + ) build = models.Build(properties=properties) try: return self.client.build_service.create_or_update_build(self.resource_group, diff --git a/src/spring/azext_spring/_client_factory.py b/src/spring/azext_spring/_client_factory.py index 31f2dce6b4b..1cb282287b0 100644 --- a/src/spring/azext_spring/_client_factory.py +++ b/src/spring/azext_spring/_client_factory.py @@ -14,6 +14,9 @@ from .vendored_sdks.appplatform.v2022_03_01_preview import ( AppPlatformManagementClient as AppPlatformManagementClient_20220301preview ) +from .vendored_sdks.appplatform.v2022_05_01_preview import ( + AppPlatformManagementClient as AppPlatformManagementClient_20220501preview +) from .vendored_sdks.appplatform.v2021_06_01_preview import ( AppPlatformManagementClient as AppPlatformManagementClient_20210601preview ) @@ -21,6 +24,8 @@ AppPlatformManagementClient as AppPlatformManagementClient_20210901preview ) +def cf_spring_20220501preview(cli_ctx, *_): + return get_mgmt_service_client(cli_ctx, AppPlatformManagementClient_20220501preview) def cf_spring_20220301preview(cli_ctx, *_): return get_mgmt_service_client(cli_ctx, AppPlatformManagementClient_20220301preview) diff --git a/src/spring/azext_spring/_help.py b/src/spring/azext_spring/_help.py index 4260ae1aaad..89a9a86e2ab 100644 --- a/src/spring/azext_spring/_help.py +++ b/src/spring/azext_spring/_help.py @@ -646,7 +646,7 @@ short-summary: Create a builder. examples: - name: Create a builder using JSON file. - text: az spring build-service builder create --name my-builder --builder-json MyJson.json --service clitest --resource-group cli + text: az spring build-service builder create --name my-builder --builder-file MyJson.json --service clitest --resource-group cli """ helps['spring build-service builder update'] = """ @@ -654,7 +654,7 @@ short-summary: Update a builder. examples: - name: Update a builder using JSON file. - text: az spring build-service builder update --name my-builder --builder-json MyJson.json --service clitest --resource-group cli + text: az spring build-service builder update --name my-builder --builder-file MyJson.json --service clitest --resource-group cli """ helps['spring build-service builder show'] = """ diff --git a/src/spring/azext_spring/_params.py b/src/spring/azext_spring/_params.py index bb5ddfce5d7..4ba49d60fce 100644 --- a/src/spring/azext_spring/_params.py +++ b/src/spring/azext_spring/_params.py @@ -24,7 +24,8 @@ validate_build_env, validate_target_module, validate_runtime_version) from ._app_validator import (fulfill_deployment_param, active_deployment_exist, ensure_not_active_deployment, validate_deloy_path, validate_deloyment_create_path, - validate_cpu, validate_memory, fulfill_deployment_param_or_warning, active_deployment_exist_or_warning) + validate_cpu, validate_build_cpu, validate_memory, validate_build_memory, + fulfill_deployment_param_or_warning, active_deployment_exist_or_warning) from ._app_managed_identity_validator import (validate_create_app_with_user_identity_or_warning, validate_create_app_with_system_identity_or_warning, validate_app_force_set_system_identity_or_warning, @@ -51,7 +52,9 @@ arg_group='Source Code deploy') # app cpu and memory cpu_type = CLIArgumentType(type=str, help='CPU resource quantity. Should be 500m or number of CPU cores.', validator=validate_cpu) -memort_type = CLIArgumentType(type=str, help='Memory resource quantity. Should be 512Mi or #Gi, e.g., 1Gi, 3Gi.', validator=validate_memory) +memory_type = CLIArgumentType(type=str, help='Memory resource quantity. Should be 512Mi or #Gi, e.g., 1Gi, 3Gi.', validator=validate_memory) +build_cpu_type = CLIArgumentType(type=str, help='CPU resource quantity. Should be 500m or number of CPU cores.', validator=validate_build_cpu) +build_memory_type = CLIArgumentType(type=str, help='Memory resource quantity. Should be 512Mi or #Gi, e.g., 1Gi, 3Gi.', validator=validate_build_memory) # pylint: disable=too-many-statements @@ -208,7 +211,7 @@ def load_arguments(self, _): validator=validate_create_app_with_user_identity_or_warning, help="Space-separated user-assigned managed identity resource IDs to assgin to an app.") c.argument('cpu', arg_type=cpu_type, default="1") - c.argument('memory', arg_type=memort_type, default="1Gi") + c.argument('memory', arg_type=memory_type, default="1Gi") c.argument('instance_count', type=int, default=1, help='Number of instance.', validator=validate_instance_count) c.argument('persistent_storage', type=str, @@ -333,7 +336,7 @@ def prepare_logs_argument(c): with self.argument_context('spring app scale') as c: c.argument('cpu', arg_type=cpu_type) - c.argument('memory', arg_type=memort_type) + c.argument('memory', arg_type=memory_type) c.argument('instance_count', type=int, help='Number of instance.', validator=validate_instance_count) for scope in ['spring app deploy', 'spring app deployment create']: @@ -369,6 +372,10 @@ def prepare_logs_argument(c): 'container_args', help='The arguments of the container image.', nargs='*', arg_group='Custom Container') c.argument( 'build_env', build_env_type) + c.argument( + 'build_cpu', arg_type=build_cpu_type) + c.argument( + 'build_memory', arg_type=build_memory_type) with self.argument_context('spring app deploy') as c: c.argument('source_path', arg_type=source_path_type, validator=validate_deloy_path) @@ -380,7 +387,7 @@ def prepare_logs_argument(c): c.argument('skip_clone_settings', help='Create staging deployment will automatically copy settings from production deployment.', action='store_true') c.argument('cpu', arg_type=cpu_type) - c.argument('memory', arg_type=memort_type) + c.argument('memory', arg_type=memory_type) c.argument('instance_count', type=int, help='Number of instance.', validator=validate_instance_count) with self.argument_context('spring app deployment') as c: diff --git a/src/spring/azext_spring/_utils.py b/src/spring/azext_spring/_utils.py index ec0a15b6f5a..4496f5ae9c6 100644 --- a/src/spring/azext_spring/_utils.py +++ b/src/spring/azext_spring/_utils.py @@ -51,7 +51,7 @@ def _pack_source_code(source_location, tar_file_path): ignore_list, ignore_list_size = _load_gitignore_file(source_location) common_vcs_ignore_list = {'.git', '.gitignore', 'bzrignore', '.hg', - '.hgignore', '.svn', '.circleci', 'target', 'docker'} + '.hgignore', '.svn', '.circleci', 'target', 'docker', 'mvnw', 'mvnw.cmd'} def _ignore_check(tarinfo, parent_ignored, parent_matching_rule_index): # ignore common vcs dir or file diff --git a/src/spring/azext_spring/app.py b/src/spring/azext_spring/app.py index 293a428c56b..2af785872f6 100644 --- a/src/spring/azext_spring/app.py +++ b/src/spring/azext_spring/app.py @@ -228,6 +228,8 @@ def app_deploy(cmd, client, resource_group, service, name, container_args=None, build_env=None, builder=None, + build_cpu=None, + build_memory=None, # deployment.settings env=None, disable_probe=None, @@ -271,6 +273,8 @@ def app_deploy(cmd, client, resource_group, service, name, 'container_command': container_command, 'container_args': container_args, 'build_env': build_env, + 'build_cpu': build_cpu, + 'build_memory': build_memory, 'builder': builder, 'no_wait': no_wait } diff --git a/src/spring/azext_spring/commands.py b/src/spring/azext_spring/commands.py index 68bcc9401f8..18473c06f6e 100644 --- a/src/spring/azext_spring/commands.py +++ b/src/spring/azext_spring/commands.py @@ -7,7 +7,8 @@ from azure.cli.core.commands import CliCommandType from azext_spring._utils import handle_asc_exception -from ._client_factory import (cf_spring_20220301preview, +from ._client_factory import (cf_spring_20220501preview, + cf_spring_20220301preview, cf_spring_20220101preview, cf_spring_20201101preview, cf_config_servers) @@ -34,7 +35,7 @@ def load_command_table(self, _): app_command = CliCommandType( operations_tmpl='azext_spring.app#{}', - client_factory=cf_spring_20220301preview + client_factory=cf_spring_20220501preview ) app_managed_identity_command = CliCommandType( @@ -164,7 +165,7 @@ def load_command_table(self, _): exception_handler=handle_asc_exception) as g: g.custom_command('create', 'deployment_create', supports_no_wait=True) - with self.command_group('spring app deployment', client_factory=cf_spring_20220101preview, + with self.command_group('spring app deployment', client_factory=cf_spring_20220501preview, exception_handler=handle_asc_exception) as g: g.custom_command('list', 'deployment_list', table_transformer=transform_spring_deployment_output) diff --git a/src/spring/azext_spring/vendored_sdks/__init__.py b/src/spring/azext_spring/vendored_sdks/__init__.py index 0260537a02b..8db66d3d0f0 100644 --- a/src/spring/azext_spring/vendored_sdks/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/__init__.py @@ -1 +1 @@ -__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py index 440ca96d17f..1497bb5f150 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py @@ -11,10 +11,11 @@ from typing import TYPE_CHECKING +from msrest import Deserializer, Serializer + from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from msrest import Deserializer, Serializer from ._configuration import AppPlatformManagementClientConfiguration @@ -32,7 +33,7 @@ def __init__(self, *args, **kwargs): pass class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): - """REST API for Azure Spring Cloud. + """REST API for Azure Spring Apps. This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). @@ -55,12 +56,11 @@ class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-07-01' + DEFAULT_API_VERSION = '2022-04-01' _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'sku': '2019-05-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -89,18 +89,16 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: - * 2019-05-01-preview: :mod:`v2019_05_01_preview.models` * 2020-07-01: :mod:`v2020_07_01.models` * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` * 2022-03-01-preview: :mod:`v2022_03_01_preview.models` + * 2022-04-01: :mod:`v2022_04_01.models` + * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` """ - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview import models - return models - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01 import models return models elif api_version == '2020-11-01-preview': @@ -118,6 +116,12 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-03-01-preview': from .v2022_03_01_preview import models return models + elif api_version == '2022-04-01': + from .v2022_04_01 import models + return models + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -126,12 +130,15 @@ def api_portal_custom_domains(self): * 2022-01-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2022-03-01-preview: :class:`ApiPortalCustomDomainsOperations` + * 2022-05-01-preview: :class:`ApiPortalCustomDomainsOperations` """ api_version = self._get_api_version('api_portal_custom_domains') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -142,12 +149,15 @@ def api_portals(self): * 2022-01-01-preview: :class:`ApiPortalsOperations` * 2022-03-01-preview: :class:`ApiPortalsOperations` + * 2022-05-01-preview: :class:`ApiPortalsOperations` """ api_version = self._get_api_version('api_portals') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ApiPortalsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ApiPortalsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import ApiPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -156,18 +166,17 @@ def api_portals(self): def apps(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`AppsOperations` * 2020-07-01: :class:`AppsOperations` * 2020-11-01-preview: :class:`AppsOperations` * 2021-06-01-preview: :class:`AppsOperations` * 2021-09-01-preview: :class:`AppsOperations` * 2022-01-01-preview: :class:`AppsOperations` * 2022-03-01-preview: :class:`AppsOperations` + * 2022-04-01: :class:`AppsOperations` + * 2022-05-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import AppsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import AppsOperations as OperationClass @@ -179,6 +188,10 @@ def apps(self): from .v2022_01_01_preview.operations import AppsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import AppsOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import AppsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import AppsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -187,18 +200,17 @@ def apps(self): def bindings(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`BindingsOperations` * 2020-07-01: :class:`BindingsOperations` * 2020-11-01-preview: :class:`BindingsOperations` * 2021-06-01-preview: :class:`BindingsOperations` * 2021-09-01-preview: :class:`BindingsOperations` * 2022-01-01-preview: :class:`BindingsOperations` * 2022-03-01-preview: :class:`BindingsOperations` + * 2022-04-01: :class:`BindingsOperations` + * 2022-05-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import BindingsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import BindingsOperations as OperationClass @@ -210,6 +222,10 @@ def bindings(self): from .v2022_01_01_preview.operations import BindingsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BindingsOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import BindingsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import BindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -220,12 +236,18 @@ def build_service(self): * 2022-01-01-preview: :class:`BuildServiceOperations` * 2022-03-01-preview: :class:`BuildServiceOperations` + * 2022-04-01: :class:`BuildServiceOperations` + * 2022-05-01-preview: :class:`BuildServiceOperations` """ api_version = self._get_api_version('build_service') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildServiceOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildServiceOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import BuildServiceOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import BuildServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -236,12 +258,18 @@ def build_service_agent_pool(self): * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` * 2022-03-01-preview: :class:`BuildServiceAgentPoolOperations` + * 2022-04-01: :class:`BuildServiceAgentPoolOperations` + * 2022-05-01-preview: :class:`BuildServiceAgentPoolOperations` """ api_version = self._get_api_version('build_service_agent_pool') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import BuildServiceAgentPoolOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -252,12 +280,18 @@ def build_service_builder(self): * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` * 2022-03-01-preview: :class:`BuildServiceBuilderOperations` + * 2022-04-01: :class:`BuildServiceBuilderOperations` + * 2022-05-01-preview: :class:`BuildServiceBuilderOperations` """ api_version = self._get_api_version('build_service_builder') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildServiceBuilderOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildServiceBuilderOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import BuildServiceBuilderOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import BuildServiceBuilderOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -268,12 +302,18 @@ def buildpack_binding(self): * 2022-01-01-preview: :class:`BuildpackBindingOperations` * 2022-03-01-preview: :class:`BuildpackBindingOperations` + * 2022-04-01: :class:`BuildpackBindingOperations` + * 2022-05-01-preview: :class:`BuildpackBindingOperations` """ api_version = self._get_api_version('buildpack_binding') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildpackBindingOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildpackBindingOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import BuildpackBindingOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import BuildpackBindingOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -282,18 +322,17 @@ def buildpack_binding(self): def certificates(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`CertificatesOperations` * 2020-07-01: :class:`CertificatesOperations` * 2020-11-01-preview: :class:`CertificatesOperations` * 2021-06-01-preview: :class:`CertificatesOperations` * 2021-09-01-preview: :class:`CertificatesOperations` * 2022-01-01-preview: :class:`CertificatesOperations` * 2022-03-01-preview: :class:`CertificatesOperations` + * 2022-04-01: :class:`CertificatesOperations` + * 2022-05-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import CertificatesOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import CertificatesOperations as OperationClass @@ -305,6 +344,10 @@ def certificates(self): from .v2022_01_01_preview.operations import CertificatesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import CertificatesOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import CertificatesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -319,6 +362,8 @@ def config_servers(self): * 2021-09-01-preview: :class:`ConfigServersOperations` * 2022-01-01-preview: :class:`ConfigServersOperations` * 2022-03-01-preview: :class:`ConfigServersOperations` + * 2022-04-01: :class:`ConfigServersOperations` + * 2022-05-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -333,6 +378,10 @@ def config_servers(self): from .v2022_01_01_preview.operations import ConfigServersOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ConfigServersOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import ConfigServersOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import ConfigServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -343,12 +392,18 @@ def configuration_services(self): * 2022-01-01-preview: :class:`ConfigurationServicesOperations` * 2022-03-01-preview: :class:`ConfigurationServicesOperations` + * 2022-04-01: :class:`ConfigurationServicesOperations` + * 2022-05-01-preview: :class:`ConfigurationServicesOperations` """ api_version = self._get_api_version('configuration_services') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ConfigurationServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ConfigurationServicesOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import ConfigurationServicesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import ConfigurationServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -357,18 +412,17 @@ def configuration_services(self): def custom_domains(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`CustomDomainsOperations` * 2020-07-01: :class:`CustomDomainsOperations` * 2020-11-01-preview: :class:`CustomDomainsOperations` * 2021-06-01-preview: :class:`CustomDomainsOperations` * 2021-09-01-preview: :class:`CustomDomainsOperations` * 2022-01-01-preview: :class:`CustomDomainsOperations` * 2022-03-01-preview: :class:`CustomDomainsOperations` + * 2022-04-01: :class:`CustomDomainsOperations` + * 2022-05-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import CustomDomainsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import CustomDomainsOperations as OperationClass @@ -380,6 +434,10 @@ def custom_domains(self): from .v2022_01_01_preview.operations import CustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import CustomDomainsOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import CustomDomainsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import CustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -388,18 +446,17 @@ def custom_domains(self): def deployments(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`DeploymentsOperations` * 2020-07-01: :class:`DeploymentsOperations` * 2020-11-01-preview: :class:`DeploymentsOperations` * 2021-06-01-preview: :class:`DeploymentsOperations` * 2021-09-01-preview: :class:`DeploymentsOperations` * 2022-01-01-preview: :class:`DeploymentsOperations` * 2022-03-01-preview: :class:`DeploymentsOperations` + * 2022-04-01: :class:`DeploymentsOperations` + * 2022-05-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import DeploymentsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import DeploymentsOperations as OperationClass @@ -411,6 +468,10 @@ def deployments(self): from .v2022_01_01_preview.operations import DeploymentsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import DeploymentsOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import DeploymentsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -421,12 +482,15 @@ def gateway_custom_domains(self): * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` * 2022-03-01-preview: :class:`GatewayCustomDomainsOperations` + * 2022-05-01-preview: :class:`GatewayCustomDomainsOperations` """ api_version = self._get_api_version('gateway_custom_domains') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import GatewayCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import GatewayCustomDomainsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import GatewayCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -437,12 +501,15 @@ def gateway_route_configs(self): * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` * 2022-03-01-preview: :class:`GatewayRouteConfigsOperations` + * 2022-05-01-preview: :class:`GatewayRouteConfigsOperations` """ api_version = self._get_api_version('gateway_route_configs') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import GatewayRouteConfigsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import GatewayRouteConfigsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import GatewayRouteConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -453,12 +520,15 @@ def gateways(self): * 2022-01-01-preview: :class:`GatewaysOperations` * 2022-03-01-preview: :class:`GatewaysOperations` + * 2022-05-01-preview: :class:`GatewaysOperations` """ api_version = self._get_api_version('gateways') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import GatewaysOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import GatewaysOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import GatewaysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -473,6 +543,8 @@ def monitoring_settings(self): * 2021-09-01-preview: :class:`MonitoringSettingsOperations` * 2022-01-01-preview: :class:`MonitoringSettingsOperations` * 2022-03-01-preview: :class:`MonitoringSettingsOperations` + * 2022-04-01: :class:`MonitoringSettingsOperations` + * 2022-05-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -487,6 +559,10 @@ def monitoring_settings(self): from .v2022_01_01_preview.operations import MonitoringSettingsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import MonitoringSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -495,18 +571,17 @@ def monitoring_settings(self): def operations(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`Operations` * 2020-07-01: :class:`Operations` * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-09-01-preview: :class:`Operations` * 2022-01-01-preview: :class:`Operations` * 2022-03-01-preview: :class:`Operations` + * 2022-04-01: :class:`Operations` + * 2022-05-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import Operations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import Operations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import Operations as OperationClass @@ -518,6 +593,10 @@ def operations(self): from .v2022_01_01_preview.operations import Operations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import Operations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import Operations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -526,18 +605,17 @@ def operations(self): def runtime_versions(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`RuntimeVersionsOperations` * 2020-07-01: :class:`RuntimeVersionsOperations` * 2020-11-01-preview: :class:`RuntimeVersionsOperations` * 2021-06-01-preview: :class:`RuntimeVersionsOperations` * 2021-09-01-preview: :class:`RuntimeVersionsOperations` * 2022-01-01-preview: :class:`RuntimeVersionsOperations` * 2022-03-01-preview: :class:`RuntimeVersionsOperations` + * 2022-04-01: :class:`RuntimeVersionsOperations` + * 2022-05-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import RuntimeVersionsOperations as OperationClass @@ -549,6 +627,10 @@ def runtime_versions(self): from .v2022_01_01_preview.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import RuntimeVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -559,12 +641,18 @@ def service_registries(self): * 2022-01-01-preview: :class:`ServiceRegistriesOperations` * 2022-03-01-preview: :class:`ServiceRegistriesOperations` + * 2022-04-01: :class:`ServiceRegistriesOperations` + * 2022-05-01-preview: :class:`ServiceRegistriesOperations` """ api_version = self._get_api_version('service_registries') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ServiceRegistriesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ServiceRegistriesOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import ServiceRegistriesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import ServiceRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -573,18 +661,17 @@ def service_registries(self): def services(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`ServicesOperations` * 2020-07-01: :class:`ServicesOperations` * 2020-11-01-preview: :class:`ServicesOperations` * 2021-06-01-preview: :class:`ServicesOperations` * 2021-09-01-preview: :class:`ServicesOperations` * 2022-01-01-preview: :class:`ServicesOperations` * 2022-03-01-preview: :class:`ServicesOperations` + * 2022-04-01: :class:`ServicesOperations` + * 2022-05-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from .v2020_07_01.operations import ServicesOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import ServicesOperations as OperationClass @@ -596,23 +683,14 @@ def services(self): from .v2022_01_01_preview.operations import ServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ServicesOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import ServicesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import ServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def sku(self): - """Instance depends on the API version: - - * 2019-05-01-preview: :class:`SkuOperations` - """ - api_version = self._get_api_version('sku') - if api_version == '2019-05-01-preview': - from .v2019_05_01_preview.operations import SkuOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'sku'".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def skus(self): """Instance depends on the API version: @@ -623,6 +701,8 @@ def skus(self): * 2021-09-01-preview: :class:`SkusOperations` * 2022-01-01-preview: :class:`SkusOperations` * 2022-03-01-preview: :class:`SkusOperations` + * 2022-04-01: :class:`SkusOperations` + * 2022-05-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -637,6 +717,10 @@ def skus(self): from .v2022_01_01_preview.operations import SkusOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import SkusOperations as OperationClass + elif api_version == '2022-04-01': + from .v2022_04_01.operations import SkusOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -648,6 +732,7 @@ def storages(self): * 2021-09-01-preview: :class:`StoragesOperations` * 2022-01-01-preview: :class:`StoragesOperations` * 2022-03-01-preview: :class:`StoragesOperations` + * 2022-05-01-preview: :class:`StoragesOperations` """ api_version = self._get_api_version('storages') if api_version == '2021-09-01-preview': @@ -656,6 +741,8 @@ def storages(self): from .v2022_01_01_preview.operations import StoragesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import StoragesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from .v2022_05_01_preview.operations import StoragesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py index 7ab9f3c3d51..60e24d4ade1 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py index 7a2a1c5bfe7..70fafb7c0fa 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py @@ -11,10 +11,11 @@ from typing import Any, Optional, TYPE_CHECKING +from msrest import Deserializer, Serializer + from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin -from msrest import Deserializer, Serializer from ._configuration import AppPlatformManagementClientConfiguration @@ -31,7 +32,7 @@ def __init__(self, *args, **kwargs): pass class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): - """REST API for Azure Spring Cloud. + """REST API for Azure Spring Apps. This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). @@ -54,12 +55,11 @@ class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2020-07-01' + DEFAULT_API_VERSION = '2022-04-01' _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'sku': '2019-05-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -88,18 +88,16 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: - * 2019-05-01-preview: :mod:`v2019_05_01_preview.models` * 2020-07-01: :mod:`v2020_07_01.models` * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` * 2022-03-01-preview: :mod:`v2022_03_01_preview.models` + * 2022-04-01: :mod:`v2022_04_01.models` + * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` """ - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview import models - return models - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01 import models return models elif api_version == '2020-11-01-preview': @@ -117,6 +115,12 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview import models return models + elif api_version == '2022-04-01': + from ..v2022_04_01 import models + return models + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -125,12 +129,15 @@ def api_portal_custom_domains(self): * 2022-01-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2022-03-01-preview: :class:`ApiPortalCustomDomainsOperations` + * 2022-05-01-preview: :class:`ApiPortalCustomDomainsOperations` """ api_version = self._get_api_version('api_portal_custom_domains') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -141,12 +148,15 @@ def api_portals(self): * 2022-01-01-preview: :class:`ApiPortalsOperations` * 2022-03-01-preview: :class:`ApiPortalsOperations` + * 2022-05-01-preview: :class:`ApiPortalsOperations` """ api_version = self._get_api_version('api_portals') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ApiPortalsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ApiPortalsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import ApiPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -155,18 +165,17 @@ def api_portals(self): def apps(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`AppsOperations` * 2020-07-01: :class:`AppsOperations` * 2020-11-01-preview: :class:`AppsOperations` * 2021-06-01-preview: :class:`AppsOperations` * 2021-09-01-preview: :class:`AppsOperations` * 2022-01-01-preview: :class:`AppsOperations` * 2022-03-01-preview: :class:`AppsOperations` + * 2022-04-01: :class:`AppsOperations` + * 2022-05-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import AppsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import AppsOperations as OperationClass @@ -178,6 +187,10 @@ def apps(self): from ..v2022_01_01_preview.aio.operations import AppsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import AppsOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import AppsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import AppsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -186,18 +199,17 @@ def apps(self): def bindings(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`BindingsOperations` * 2020-07-01: :class:`BindingsOperations` * 2020-11-01-preview: :class:`BindingsOperations` * 2021-06-01-preview: :class:`BindingsOperations` * 2021-09-01-preview: :class:`BindingsOperations` * 2022-01-01-preview: :class:`BindingsOperations` * 2022-03-01-preview: :class:`BindingsOperations` + * 2022-04-01: :class:`BindingsOperations` + * 2022-05-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import BindingsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import BindingsOperations as OperationClass @@ -209,6 +221,10 @@ def bindings(self): from ..v2022_01_01_preview.aio.operations import BindingsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BindingsOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import BindingsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import BindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -219,12 +235,18 @@ def build_service(self): * 2022-01-01-preview: :class:`BuildServiceOperations` * 2022-03-01-preview: :class:`BuildServiceOperations` + * 2022-04-01: :class:`BuildServiceOperations` + * 2022-05-01-preview: :class:`BuildServiceOperations` """ api_version = self._get_api_version('build_service') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildServiceOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildServiceOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import BuildServiceOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import BuildServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -235,12 +257,18 @@ def build_service_agent_pool(self): * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` * 2022-03-01-preview: :class:`BuildServiceAgentPoolOperations` + * 2022-04-01: :class:`BuildServiceAgentPoolOperations` + * 2022-05-01-preview: :class:`BuildServiceAgentPoolOperations` """ api_version = self._get_api_version('build_service_agent_pool') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import BuildServiceAgentPoolOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -251,12 +279,18 @@ def build_service_builder(self): * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` * 2022-03-01-preview: :class:`BuildServiceBuilderOperations` + * 2022-04-01: :class:`BuildServiceBuilderOperations` + * 2022-05-01-preview: :class:`BuildServiceBuilderOperations` """ api_version = self._get_api_version('build_service_builder') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import BuildServiceBuilderOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -267,12 +301,18 @@ def buildpack_binding(self): * 2022-01-01-preview: :class:`BuildpackBindingOperations` * 2022-03-01-preview: :class:`BuildpackBindingOperations` + * 2022-04-01: :class:`BuildpackBindingOperations` + * 2022-05-01-preview: :class:`BuildpackBindingOperations` """ api_version = self._get_api_version('buildpack_binding') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildpackBindingOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildpackBindingOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import BuildpackBindingOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import BuildpackBindingOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -281,18 +321,17 @@ def buildpack_binding(self): def certificates(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`CertificatesOperations` * 2020-07-01: :class:`CertificatesOperations` * 2020-11-01-preview: :class:`CertificatesOperations` * 2021-06-01-preview: :class:`CertificatesOperations` * 2021-09-01-preview: :class:`CertificatesOperations` * 2022-01-01-preview: :class:`CertificatesOperations` * 2022-03-01-preview: :class:`CertificatesOperations` + * 2022-04-01: :class:`CertificatesOperations` + * 2022-05-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import CertificatesOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import CertificatesOperations as OperationClass @@ -304,6 +343,10 @@ def certificates(self): from ..v2022_01_01_preview.aio.operations import CertificatesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -318,6 +361,8 @@ def config_servers(self): * 2021-09-01-preview: :class:`ConfigServersOperations` * 2022-01-01-preview: :class:`ConfigServersOperations` * 2022-03-01-preview: :class:`ConfigServersOperations` + * 2022-04-01: :class:`ConfigServersOperations` + * 2022-05-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -332,6 +377,10 @@ def config_servers(self): from ..v2022_01_01_preview.aio.operations import ConfigServersOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ConfigServersOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import ConfigServersOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import ConfigServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -342,12 +391,18 @@ def configuration_services(self): * 2022-01-01-preview: :class:`ConfigurationServicesOperations` * 2022-03-01-preview: :class:`ConfigurationServicesOperations` + * 2022-04-01: :class:`ConfigurationServicesOperations` + * 2022-05-01-preview: :class:`ConfigurationServicesOperations` """ api_version = self._get_api_version('configuration_services') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import ConfigurationServicesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -356,18 +411,17 @@ def configuration_services(self): def custom_domains(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`CustomDomainsOperations` * 2020-07-01: :class:`CustomDomainsOperations` * 2020-11-01-preview: :class:`CustomDomainsOperations` * 2021-06-01-preview: :class:`CustomDomainsOperations` * 2021-09-01-preview: :class:`CustomDomainsOperations` * 2022-01-01-preview: :class:`CustomDomainsOperations` * 2022-03-01-preview: :class:`CustomDomainsOperations` + * 2022-04-01: :class:`CustomDomainsOperations` + * 2022-05-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import CustomDomainsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import CustomDomainsOperations as OperationClass @@ -379,6 +433,10 @@ def custom_domains(self): from ..v2022_01_01_preview.aio.operations import CustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import CustomDomainsOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import CustomDomainsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -387,18 +445,17 @@ def custom_domains(self): def deployments(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`DeploymentsOperations` * 2020-07-01: :class:`DeploymentsOperations` * 2020-11-01-preview: :class:`DeploymentsOperations` * 2021-06-01-preview: :class:`DeploymentsOperations` * 2021-09-01-preview: :class:`DeploymentsOperations` * 2022-01-01-preview: :class:`DeploymentsOperations` * 2022-03-01-preview: :class:`DeploymentsOperations` + * 2022-04-01: :class:`DeploymentsOperations` + * 2022-05-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import DeploymentsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import DeploymentsOperations as OperationClass @@ -410,6 +467,10 @@ def deployments(self): from ..v2022_01_01_preview.aio.operations import DeploymentsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -420,12 +481,15 @@ def gateway_custom_domains(self): * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` * 2022-03-01-preview: :class:`GatewayCustomDomainsOperations` + * 2022-05-01-preview: :class:`GatewayCustomDomainsOperations` """ api_version = self._get_api_version('gateway_custom_domains') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -436,12 +500,15 @@ def gateway_route_configs(self): * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` * 2022-03-01-preview: :class:`GatewayRouteConfigsOperations` + * 2022-05-01-preview: :class:`GatewayRouteConfigsOperations` """ api_version = self._get_api_version('gateway_route_configs') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -452,12 +519,15 @@ def gateways(self): * 2022-01-01-preview: :class:`GatewaysOperations` * 2022-03-01-preview: :class:`GatewaysOperations` + * 2022-05-01-preview: :class:`GatewaysOperations` """ api_version = self._get_api_version('gateways') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import GatewaysOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import GatewaysOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import GatewaysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -472,6 +542,8 @@ def monitoring_settings(self): * 2021-09-01-preview: :class:`MonitoringSettingsOperations` * 2022-01-01-preview: :class:`MonitoringSettingsOperations` * 2022-03-01-preview: :class:`MonitoringSettingsOperations` + * 2022-04-01: :class:`MonitoringSettingsOperations` + * 2022-05-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -486,6 +558,10 @@ def monitoring_settings(self): from ..v2022_01_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import MonitoringSettingsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -494,18 +570,17 @@ def monitoring_settings(self): def operations(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`Operations` * 2020-07-01: :class:`Operations` * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-09-01-preview: :class:`Operations` * 2022-01-01-preview: :class:`Operations` * 2022-03-01-preview: :class:`Operations` + * 2022-04-01: :class:`Operations` + * 2022-05-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import Operations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import Operations as OperationClass @@ -517,6 +592,10 @@ def operations(self): from ..v2022_01_01_preview.aio.operations import Operations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import Operations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -525,18 +604,17 @@ def operations(self): def runtime_versions(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`RuntimeVersionsOperations` * 2020-07-01: :class:`RuntimeVersionsOperations` * 2020-11-01-preview: :class:`RuntimeVersionsOperations` * 2021-06-01-preview: :class:`RuntimeVersionsOperations` * 2021-09-01-preview: :class:`RuntimeVersionsOperations` * 2022-01-01-preview: :class:`RuntimeVersionsOperations` * 2022-03-01-preview: :class:`RuntimeVersionsOperations` + * 2022-04-01: :class:`RuntimeVersionsOperations` + * 2022-05-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass @@ -548,6 +626,10 @@ def runtime_versions(self): from ..v2022_01_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -558,12 +640,18 @@ def service_registries(self): * 2022-01-01-preview: :class:`ServiceRegistriesOperations` * 2022-03-01-preview: :class:`ServiceRegistriesOperations` + * 2022-04-01: :class:`ServiceRegistriesOperations` + * 2022-05-01-preview: :class:`ServiceRegistriesOperations` """ api_version = self._get_api_version('service_registries') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import ServiceRegistriesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -572,18 +660,17 @@ def service_registries(self): def services(self): """Instance depends on the API version: - * 2019-05-01-preview: :class:`ServicesOperations` * 2020-07-01: :class:`ServicesOperations` * 2020-11-01-preview: :class:`ServicesOperations` * 2021-06-01-preview: :class:`ServicesOperations` * 2021-09-01-preview: :class:`ServicesOperations` * 2022-01-01-preview: :class:`ServicesOperations` * 2022-03-01-preview: :class:`ServicesOperations` + * 2022-04-01: :class:`ServicesOperations` + * 2022-05-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2020-07-01': + if api_version == '2020-07-01': from ..v2020_07_01.aio.operations import ServicesOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import ServicesOperations as OperationClass @@ -595,23 +682,14 @@ def services(self): from ..v2022_01_01_preview.aio.operations import ServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ServicesOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import ServicesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import ServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property - def sku(self): - """Instance depends on the API version: - - * 2019-05-01-preview: :class:`SkuOperations` - """ - api_version = self._get_api_version('sku') - if api_version == '2019-05-01-preview': - from ..v2019_05_01_preview.aio.operations import SkuOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'sku'".format(api_version)) - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) - @property def skus(self): """Instance depends on the API version: @@ -622,6 +700,8 @@ def skus(self): * 2021-09-01-preview: :class:`SkusOperations` * 2022-01-01-preview: :class:`SkusOperations` * 2022-03-01-preview: :class:`SkusOperations` + * 2022-04-01: :class:`SkusOperations` + * 2022-05-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -636,6 +716,10 @@ def skus(self): from ..v2022_01_01_preview.aio.operations import SkusOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import SkusOperations as OperationClass + elif api_version == '2022-04-01': + from ..v2022_04_01.aio.operations import SkusOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -647,6 +731,7 @@ def storages(self): * 2021-09-01-preview: :class:`StoragesOperations` * 2022-01-01-preview: :class:`StoragesOperations` * 2022-03-01-preview: :class:`StoragesOperations` + * 2022-05-01-preview: :class:`StoragesOperations` """ api_version = self._get_api_version('storages') if api_version == '2021-09-01-preview': @@ -655,6 +740,8 @@ def storages(self): from ..v2022_01_01_preview.aio.operations import StoragesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import StoragesOperations as OperationClass + elif api_version == '2022-05-01-preview': + from ..v2022_05_01_preview.aio.operations import StoragesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py index d383d0e0754..10eb9d6f0e9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/models.py b/src/spring/azext_spring/vendored_sdks/appplatform/models.py index d1b4c8d0d9b..7d9f8183c1a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/models.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/models.py @@ -4,5 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2019_05_01_preview.models import * -from .v2020_07_01.models import * +from .v2022_04_01.models import * diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py index d2ddf950056..41ec6d71ff7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py index bbb07fef27c..6d7ae544c6a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py @@ -6,34 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -41,7 +30,8 @@ class AppPlatformManagementClient(object): :ivar config_servers: ConfigServersOperations operations :vartype config_servers: azure.mgmt.appplatform.v2020_07_01.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_07_01.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -55,75 +45,76 @@ class AppPlatformManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_07_01.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2020_07_01.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2020_07_01.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_07_01.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py index 2e027c53459..d275183a2af 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py index 39f10548873..44ce4a5043f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py index 497d1a0e0b0..a183031693f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py @@ -6,40 +6,33 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_07_01.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2020_07_01.aio.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2020_07_01.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2020_07_01.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2020_07_01.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_07_01.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -47,79 +40,83 @@ class AppPlatformManagementClient(object): :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.appplatform.v2020_07_01.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2020_07_01.aio.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2020_07_01.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.appplatform.v2020_07_01.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_07_01.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2020_07_01.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2020_07_01.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_07_01.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py index 101a93f7aef..fe974e61f1b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-07-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py index 96a7b447e45..c8185f126f4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -60,7 +65,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -72,31 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,34 +127,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -171,8 +170,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,14 +196,20 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -215,28 +223,22 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -246,11 +248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -262,29 +264,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -294,9 +293,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -314,14 +315,17 @@ async def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,25 +338,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,9 +359,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore async def _update_initial( self, @@ -379,34 +376,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -423,8 +416,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,14 +442,20 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -467,28 +469,22 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -498,10 +494,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -516,45 +513,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,7 +563,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,29 +609,26 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -638,8 +641,11 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -669,34 +675,30 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -709,4 +711,6 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py index 732cfe5da5c..a5ad80d960f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py index 6407846b0e5..6f03d9552dd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,14 +192,20 @@ async def begin_create_or_update( :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -210,28 +219,22 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +244,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -257,29 +260,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,9 +289,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -309,14 +311,17 @@ async def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -329,25 +334,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,10 +355,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -375,45 +374,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -422,7 +424,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +437,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py index 7e48efe0d06..88c5815fdad 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -176,14 +178,20 @@ async def begin_update_put( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -196,27 +204,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +229,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +245,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +284,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,14 +307,20 @@ async def begin_update_patch( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -325,27 +333,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,9 +358,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _validate_initial( self, @@ -371,33 +374,29 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -414,8 +413,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -434,14 +436,20 @@ async def begin_validate( :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -454,27 +462,22 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -484,6 +487,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py index 46bb8daccbc..4a037502866 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py index 36566cc712b..988d0302576 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,51 +534,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -592,7 +591,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,11 +604,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -620,50 +625,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -672,7 +680,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,12 +693,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -699,30 +712,27 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -732,9 +742,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + - async def begin_start( + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -755,14 +767,17 @@ async def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -776,26 +791,18 @@ async def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,11 +812,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - async def _stop_initial( + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -822,30 +829,27 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -855,9 +859,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - async def begin_stop( + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -878,14 +884,17 @@ async def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -899,26 +908,18 @@ async def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -928,11 +929,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _restart_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -945,30 +946,27 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,9 +976,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - async def begin_restart( + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1001,14 +1001,17 @@ async def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1022,26 +1025,18 @@ async def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1051,10 +1046,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,30 +1080,27 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1122,4 +1115,6 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py index 4dc1442371f..61082351ede 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,6 +360,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py index d114e98657e..ab4aa3d1ff9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,38 +53,40 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,7 +95,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +108,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py index 1d3ccd3dbfe..c2ea04af068 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,22 +60,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,4 +88,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py index 092b2ee09fc..ea48483c3ad 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,28 +71,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +102,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -114,33 +118,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,8 +160,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,14 +183,20 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -200,27 +209,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,11 +234,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -245,28 +249,25 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -276,9 +277,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -293,14 +296,17 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -312,24 +318,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore async def _update_initial( self, @@ -355,33 +355,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -398,8 +394,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,14 +417,20 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -438,27 +443,22 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,10 +468,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,28 +496,25 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -529,8 +527,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +547,8 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys @@ -557,33 +559,29 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,9 +594,12 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - async def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -621,28 +622,25 @@ async def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,8 +650,10 @@ async def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,28 +677,25 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,8 +708,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,7 +724,8 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability @@ -735,32 +736,28 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -773,8 +770,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,42 +783,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -827,7 +827,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -836,11 +840,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -853,43 +859,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -898,7 +905,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -907,7 +918,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py index c7de60e3a3f..e105e348611 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,43 +52,44 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,7 +98,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,7 +111,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py index 5659fe3dbc3..e4dbda7bd1b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py @@ -6,146 +6,78 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AppResource - from ._models_py3 import AppResourceCollection - from ._models_py3 import AppResourceProperties - from ._models_py3 import AvailableOperations - from ._models_py3 import AvailableRuntimeVersions - from ._models_py3 import BindingResource - from ._models_py3 import BindingResourceCollection - from ._models_py3 import BindingResourceProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateResource - from ._models_py3 import CertificateResourceCollection - from ._models_py3 import CloudErrorBody - from ._models_py3 import ClusterResourceProperties - from ._models_py3 import ConfigServerGitProperty - from ._models_py3 import ConfigServerProperties - from ._models_py3 import ConfigServerResource - from ._models_py3 import ConfigServerSettings - from ._models_py3 import ConfigServerSettingsErrorRecord - from ._models_py3 import ConfigServerSettingsValidateResult - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - from ._models_py3 import LogFileUrlResponse - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedIdentityProperties - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import MonitoringSettingProperties - from ._models_py3 import MonitoringSettingResource - from ._models_py3 import NameAvailability - from ._models_py3 import NameAvailabilityParameters - from ._models_py3 import NetworkProfile - from ._models_py3 import NetworkProfileOutboundIPs - from ._models_py3 import OperationDetail - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationProperties - from ._models_py3 import PersistentDisk - from ._models_py3 import ProxyResource - from ._models_py3 import RegenerateTestKeyRequestPayload - from ._models_py3 import RequiredTraffic - from ._models_py3 import Resource - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCollection - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkuZoneDetails - from ._models_py3 import ResourceUploadDefinition - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuCapacity - from ._models_py3 import SupportedRuntimeVersion - from ._models_py3 import TemporaryDisk - from ._models_py3 import TestKeys - from ._models_py3 import TrackedResource - from ._models_py3 import UserSourceInfo -except (SyntaxError, ImportError): - from ._models import AppResource # type: ignore - from ._models import AppResourceCollection # type: ignore - from ._models import AppResourceProperties # type: ignore - from ._models import AvailableOperations # type: ignore - from ._models import AvailableRuntimeVersions # type: ignore - from ._models import BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -233,6 +165,7 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py index 5ac8dede62c..48326092115 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -35,7 +26,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -45,7 +36,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -54,7 +45,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -66,7 +57,7 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -75,7 +66,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -84,7 +75,7 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -98,7 +89,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -106,14 +97,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -121,7 +112,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -129,14 +120,14 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -144,21 +135,21 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py index b1dad0b57a2..011dec21acc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py @@ -42,6 +42,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -77,6 +79,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -91,12 +95,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource. - :type identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with its parent resource. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -122,6 +126,15 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -131,11 +144,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -150,6 +163,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -160,26 +180,26 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App. - :type active_deployment_name: str - :param fqdn: Fully qualified dns Name. - :type fqdn: str - :param https_only: Indicate if only https is allowed. - :type https_only: bool + :ivar active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :param temporary_disk: Temporary disk settings. - :type temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk - :param persistent_disk: Persistent disk settings. - :type persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk """ _validation = { @@ -211,6 +231,20 @@ def __init__( persistent_disk: Optional["PersistentDisk"] = None, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -226,11 +260,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -245,6 +279,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -271,6 +312,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -286,8 +329,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties + :ivar properties: Properties of the Binding resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties """ _validation = { @@ -309,6 +352,10 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -316,11 +363,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -335,6 +382,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -349,12 +403,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource. - :type resource_id: str - :param key: The key of the bound resource. - :type key: str - :param binding_parameters: Binding parameters of the Binding resource. - :type binding_parameters: dict[str, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -391,6 +445,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -411,12 +473,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -464,6 +526,14 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -488,8 +558,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties """ _validation = { @@ -511,6 +581,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -518,10 +592,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -536,6 +610,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -544,17 +624,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] """ _attribute_map = { @@ -573,6 +653,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -590,8 +683,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -617,6 +710,10 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -629,26 +726,26 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -683,6 +780,28 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -705,10 +824,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerState - :param error: Error when apply config server settings. - :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :param config_server: Settings of config server. - :type config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings """ _validation = { @@ -728,6 +847,12 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -745,8 +870,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties """ _validation = { @@ -768,6 +893,10 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -775,8 +904,8 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :param git_property: Property of git environment. - :type git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty + :ivar git_property: Property of git environment. + :vartype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty """ _attribute_map = { @@ -789,6 +918,10 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -796,12 +929,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record. - :type name: str - :param uri: The uri of the config server settings error record. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -818,6 +951,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -827,10 +968,11 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] """ _attribute_map = { @@ -845,6 +987,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -855,12 +1004,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param thumbprint: The thumbprint of bound certificate. - :type thumbprint: str + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -880,6 +1029,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -897,8 +1052,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties """ _validation = { @@ -920,6 +1075,10 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -927,10 +1086,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -945,6 +1104,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -955,8 +1120,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -973,6 +1138,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -980,10 +1149,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -998,6 +1167,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1040,6 +1215,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1059,10 +1236,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -1086,6 +1263,12 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1094,11 +1277,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1113,6 +1296,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1123,12 +1313,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or @@ -1171,6 +1361,12 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1185,20 +1381,20 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard tier should be in range (1, 8). - :type memory_in_gb: int - :param jvm_options: JVM parameter. - :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative to zip root. - :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :type runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion + :vartype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion """ _attribute_map = { @@ -1221,6 +1417,22 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1233,10 +1445,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1251,6 +1463,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1261,28 +1479,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1320,6 +1538,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1339,8 +1581,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1357,6 +1599,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1364,12 +1610,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1386,6 +1632,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1395,13 +1649,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1418,6 +1672,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1427,13 +1690,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1450,6 +1713,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1459,31 +1731,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: Unit that makes sense for the metric. - :type unit: str - :param category: Name of the metric category that the metric belongs to. A metric can only + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types. - :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric. - :type dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] - :param source_mdm_namespace: Name of the MDM namespace. Optional. - :type source_mdm_namespace: str + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1516,6 +1788,33 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1539,12 +1838,12 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingState - :param error: Error when apply Monitoring Setting changes. - :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :param trace_enabled: Indicates whether enable the trace functionality. - :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight instrumentation key. - :type app_insights_instrumentation_key: str + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key. + :vartype app_insights_instrumentation_key: str """ _validation = { @@ -1566,6 +1865,14 @@ def __init__( app_insights_instrumentation_key: Optional[str] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key. + :paramtype app_insights_instrumentation_key: str + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1584,8 +1891,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties """ _validation = { @@ -1607,6 +1914,10 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -1614,12 +1925,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1636,6 +1947,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1647,10 +1966,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1670,6 +1989,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -1680,20 +2005,19 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfileOutboundIPs :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. @@ -1725,6 +2049,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -1756,6 +2096,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1763,22 +2105,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: Display of the operation. - :type display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :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.appplatform.v2020_07_01.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1793,10 +2145,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :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.appplatform.v2020_07_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -1804,14 +2169,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :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 = { @@ -1830,6 +2195,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1840,8 +2215,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification """ _attribute_map = { @@ -1854,6 +2229,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1863,12 +2243,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1889,6 +2269,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -1900,9 +2286,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: "Primary", + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType + :vartype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType """ _validation = { @@ -1919,6 +2305,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -1961,6 +2352,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -1972,22 +2365,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :param tier: Gets the tier of SKU. - :type tier: str - :param capacity: Gets the capacity of SKU. - :type capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity - :param locations: Gets the set of locations that the SKU is available. - :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in those locations where + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is + :vartype location_info: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] + :vartype restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] """ _attribute_map = { @@ -2012,6 +2406,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2025,10 +2439,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2043,6 +2457,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2051,11 +2471,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2070,6 +2490,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2078,12 +2505,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU. - :type location: str - :param zones: Gets list of availability zones where the SKU is supported. - :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in specific zones. - :type zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] """ _attribute_map = { @@ -2100,6 +2527,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2109,10 +2545,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted. - :type locations: list[str] - :param zones: Gets list of availability zones where the SKU is restricted. - :type zones: list[str] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2127,6 +2563,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2135,19 +2577,20 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :ivar values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :vartype restriction_info: + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode """ @@ -2167,6 +2610,23 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2177,12 +2637,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :param name: Gets the set of zones that the SKU is available in with the + :ivar name: Gets the set of zones that the SKU is available in with the specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] + :vartype capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] """ _attribute_map = { @@ -2197,6 +2657,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2205,10 +2674,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2223,6 +2692,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2239,11 +2714,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2267,6 +2742,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2283,15 +2765,15 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - :param properties: Properties of the Service resource. - :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties - :param sku: Sku of the Service resource. - :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -2319,6 +2801,17 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2327,11 +2820,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2346,6 +2839,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2354,10 +2854,10 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] """ @@ -2373,6 +2873,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2381,12 +2889,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2403,6 +2911,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2414,15 +2930,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :type maximum: int - :param default: Gets or sets the default. - :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType + :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType """ _validation = { @@ -2445,6 +2961,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2455,14 +2982,14 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :vartype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2479,6 +3006,16 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -2488,10 +3025,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB. - :type size_in_gb: int - :param mount_path: Mount path of the temporary disk. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2510,6 +3047,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -2518,16 +3061,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2548,6 +3091,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2559,17 +3114,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source". - :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param version: Version of the source. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :type artifact_selector: str + :vartype artifact_selector: str """ _attribute_map = { @@ -2588,6 +3143,19 @@ def __init__( artifact_selector: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py index 5be695c7364..09cccf2f395 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,319 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +342,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - sync_status=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -65,7 +360,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,31 +372,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,50 +405,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -177,17 +465,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -201,14 +491,19 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -222,28 +517,22 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -253,46 +542,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,16 +587,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,14 +609,17 @@ def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -343,25 +632,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -371,52 +653,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -433,17 +710,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -457,14 +736,19 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -478,28 +762,22 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -509,17 +787,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.AppResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -528,45 +806,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -575,7 +856,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,19 +869,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace def get_resource_upload_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -616,29 +902,26 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -651,17 +934,19 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace def validate_domain( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -683,34 +968,30 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -723,4 +1004,6 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py index 4d01d1bab12..ef560219299 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.BindingResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py index f60d181ac48..2eff878a63c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,185 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +208,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +235,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +267,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,17 +327,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -196,14 +353,20 @@ def begin_create_or_update( :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -217,28 +380,22 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,46 +405,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -297,16 +450,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,14 +472,17 @@ def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,25 +495,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,17 +516,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateResourceCollection"]: """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -385,45 +535,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -432,7 +585,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +598,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py index c4dfb55f98b..354d13f4ec3 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,194 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +217,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +241,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +272,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +327,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -183,14 +350,20 @@ def begin_update_put( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -203,27 +376,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +401,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +456,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -314,14 +479,20 @@ def begin_update_patch( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -334,27 +505,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,50 +530,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _validate_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -424,16 +585,18 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace def begin_validate( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -445,14 +608,20 @@ def begin_validate( :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,27 +634,22 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -495,6 +659,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py index 4b7051f56c7..e1ab08c8fc8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainResourceCollection"]: """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py index 7c9649aea65..0685c35e7aa 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,445 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,15 +468,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +498,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +531,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +593,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +622,20 @@ def begin_create_or_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -227,29 +650,22 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +675,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +722,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +747,17 @@ def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +771,18 @@ def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +792,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +851,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +880,20 @@ def begin_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -497,29 +908,22 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,19 +933,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,51 +955,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,7 +1012,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,19 +1025,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, - resource_group_name, # type: str - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -633,50 +1046,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -685,7 +1101,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -694,49 +1114,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -746,17 +1163,18 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + - def begin_start( + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,14 +1188,17 @@ def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,26 +1212,18 @@ def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -820,48 +1233,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - def _stop_initial( + def _stop_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -871,17 +1280,18 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - def begin_stop( + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,14 +1305,17 @@ def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -916,26 +1329,18 @@ def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -945,48 +1350,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _restart_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -996,17 +1397,18 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - def begin_restart( + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,14 +1422,17 @@ def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1041,26 +1446,18 @@ def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,19 +1467,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace def get_log_file_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1104,30 +1501,27 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1142,4 +1536,6 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py index 417872e32c6..1b145d7f6ad 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,150 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +173,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +197,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +228,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +283,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +303,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -203,27 +333,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +358,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +413,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +433,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -334,27 +463,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,6 +488,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py index 8805b707216..17678c09ffc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,47 +73,49 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +137,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py index 0833e317039..96087c60009 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,49 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,22 +89,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py index 6e2ae13f774..011cf1eb7f0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,447 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +470,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -71,28 +494,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,48 +525,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,16 +583,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -187,14 +606,20 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -207,27 +632,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -237,44 +657,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -284,15 +700,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,14 +719,17 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -321,24 +741,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,50 +762,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -408,16 +817,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -429,14 +840,20 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -449,27 +866,22 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -479,17 +891,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + @distributed_trace def list_test_keys( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -507,28 +919,25 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,16 +950,18 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace def regenerate_test_key( self, - resource_group_name, # type: str - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -559,7 +970,8 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys @@ -570,33 +982,29 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -609,15 +1017,17 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -635,28 +1045,25 @@ def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -666,15 +1073,16 @@ def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace def enable_test_endpoint( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -692,28 +1100,25 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-07-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,21 +1131,24 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace def check_name_availability( self, - location, # type: str - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability @@ -751,32 +1159,28 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -789,53 +1193,55 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -844,7 +1250,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -853,17 +1263,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -871,43 +1282,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -916,7 +1328,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -925,7 +1341,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py index 4e05d050f70..3f9b1adf699 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,56 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class SkusOperations(object): """SkusOperations operations. @@ -45,51 +79,52 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-07-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,7 +133,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +146,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py index d2ddf950056..41ec6d71ff7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py index 3e902325d70..c0648f257f3 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py @@ -6,124 +6,119 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2020_11_01_preview.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2020_11_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2020_11_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2020_11_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2020_11_01_preview.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2020_11_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2020_11_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2020_11_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2020_11_01_preview.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2020_11_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_11_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2020_11_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2020_11_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py index 9678a78ee77..c42f5779459 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-11-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py index 39f10548873..44ce4a5043f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py index 5ca00dfff68..89198b7ef24 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py @@ -6,120 +6,119 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py index 89cd6bbbc8e..ceda2426d5f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2020-11-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py index 19ae5271884..070f860b6e5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -60,7 +65,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -72,31 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,34 +127,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -171,8 +170,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,14 +196,20 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -215,28 +223,22 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -246,11 +248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -262,29 +264,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -294,9 +293,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -314,14 +315,17 @@ async def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,25 +338,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,9 +359,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore async def _update_initial( self, @@ -379,34 +376,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -423,8 +416,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,14 +442,20 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -467,28 +469,22 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -498,10 +494,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -516,45 +513,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,7 +563,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,29 +609,26 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -638,8 +641,11 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -658,7 +664,8 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult @@ -669,34 +676,30 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -709,4 +712,6 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py index 77f8b3f7fe8..76b37e85fda 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py index 71b2ff176be..623d65bb8da 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,17 +189,24 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -210,28 +220,22 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +245,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -257,29 +261,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,9 +290,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -309,14 +312,17 @@ async def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -329,25 +335,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,10 +356,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -375,45 +375,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -422,7 +425,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +438,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py index 175fc48484d..cde7409fb45 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,9 +360,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _validate_initial( self, @@ -371,33 +376,29 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -414,8 +415,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -431,17 +435,24 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -454,27 +465,22 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -484,6 +490,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py index 40546c17e4f..342334a95ff 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py index 1428ce78df9..8d604047680 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,17 +198,24 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -220,29 +230,22 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +255,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +272,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +302,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +327,17 @@ async def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +351,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +372,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore async def _update_initial( self, @@ -393,35 +390,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +431,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -461,17 +457,24 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -486,29 +489,22 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +514,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,51 +536,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -592,7 +593,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,11 +606,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -620,50 +627,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -672,7 +682,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,12 +695,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -699,30 +714,27 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -732,9 +744,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + - async def begin_start( + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -755,14 +769,17 @@ async def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -776,26 +793,18 @@ async def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,11 +814,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - async def _stop_initial( + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -822,30 +831,27 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -855,9 +861,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - async def begin_stop( + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -878,14 +886,17 @@ async def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -899,26 +910,18 @@ async def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -928,11 +931,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _restart_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -945,30 +948,27 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,9 +978,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - async def begin_restart( + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1001,14 +1003,17 @@ async def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1022,26 +1027,18 @@ async def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1051,10 +1048,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,30 +1082,27 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1122,4 +1117,6 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py index 6ee477698c7..16602bed5ec 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,6 +360,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py index 4353874d448..bf7f85fc01b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,38 +53,40 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,7 +95,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +108,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py index a4d56940113..63a48bbde4d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,22 +60,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,4 +88,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py index b525473b065..21ec27a3598 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,28 +71,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +102,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -114,33 +118,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,8 +160,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,14 +183,20 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -200,27 +209,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,11 +234,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -245,28 +249,25 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -276,9 +277,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -293,14 +296,17 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -312,24 +318,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore async def _update_initial( self, @@ -355,33 +355,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -398,8 +394,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,14 +417,20 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -438,27 +443,22 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,10 +468,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,28 +496,25 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -529,8 +527,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +547,8 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys @@ -557,33 +559,29 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,9 +594,12 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - async def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -621,28 +622,25 @@ async def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,8 +650,10 @@ async def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,28 +677,25 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,8 +708,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,7 +724,8 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability @@ -735,32 +736,28 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -773,8 +770,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,42 +783,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -827,7 +827,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -836,11 +840,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -853,43 +859,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -898,7 +905,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -907,7 +918,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py index 7fe9f418d62..6c5411a3e6d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,43 +52,44 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,7 +98,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,7 +111,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py index 6ff92bf6005..97492b478ee 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py @@ -6,148 +6,79 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AppResource - from ._models_py3 import AppResourceCollection - from ._models_py3 import AppResourceProperties - from ._models_py3 import ApplicationInsightsAgentVersions - from ._models_py3 import AvailableOperations - from ._models_py3 import AvailableRuntimeVersions - from ._models_py3 import BindingResource - from ._models_py3 import BindingResourceCollection - from ._models_py3 import BindingResourceProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateResource - from ._models_py3 import CertificateResourceCollection - from ._models_py3 import CloudErrorBody - from ._models_py3 import ClusterResourceProperties - from ._models_py3 import ConfigServerGitProperty - from ._models_py3 import ConfigServerProperties - from ._models_py3 import ConfigServerResource - from ._models_py3 import ConfigServerSettings - from ._models_py3 import ConfigServerSettingsErrorRecord - from ._models_py3 import ConfigServerSettingsValidateResult - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - from ._models_py3 import LogFileUrlResponse - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedIdentityProperties - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import MonitoringSettingProperties - from ._models_py3 import MonitoringSettingResource - from ._models_py3 import NameAvailability - from ._models_py3 import NameAvailabilityParameters - from ._models_py3 import NetworkProfile - from ._models_py3 import NetworkProfileOutboundIPs - from ._models_py3 import OperationDetail - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationProperties - from ._models_py3 import PersistentDisk - from ._models_py3 import ProxyResource - from ._models_py3 import RegenerateTestKeyRequestPayload - from ._models_py3 import RequiredTraffic - from ._models_py3 import Resource - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCollection - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkuZoneDetails - from ._models_py3 import ResourceUploadDefinition - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuCapacity - from ._models_py3 import SupportedRuntimeVersion - from ._models_py3 import TemporaryDisk - from ._models_py3 import TestKeys - from ._models_py3 import TrackedResource - from ._models_py3 import UserSourceInfo -except (SyntaxError, ImportError): - from ._models import AppResource # type: ignore - from ._models import AppResourceCollection # type: ignore - from ._models import AppResourceProperties # type: ignore - from ._models import ApplicationInsightsAgentVersions # type: ignore - from ._models import AvailableOperations # type: ignore - from ._models import AvailableRuntimeVersions # type: ignore - from ._models import BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -236,6 +167,7 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py index 5ac8dede62c..48326092115 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -35,7 +26,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -45,7 +36,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -54,7 +45,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -66,7 +57,7 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -75,7 +66,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -84,7 +75,7 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -98,7 +89,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -106,14 +97,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -121,7 +112,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -129,14 +120,14 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -144,21 +135,21 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py index e8b893255fd..b933174dc56 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -67,6 +69,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -102,6 +106,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -116,12 +122,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource. - :type identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with its parent resource. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -147,6 +153,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -156,11 +172,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -175,6 +191,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -185,28 +208,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App. - :type active_deployment_name: str - :param fqdn: Fully qualified dns Name. - :type fqdn: str - :param https_only: Indicate if only https is allowed. - :type https_only: bool + :ivar active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :param temporary_disk: Temporary disk settings. - :type temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings. - :type persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk - :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :type enable_end_to_end_tls: bool + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool """ _validation = { @@ -240,6 +263,22 @@ def __init__( enable_end_to_end_tls: Optional[bool] = False, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -256,11 +295,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -275,6 +314,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -302,6 +348,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -317,8 +365,9 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties """ _validation = { @@ -340,6 +389,11 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -347,11 +401,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -366,6 +420,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -380,12 +441,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource. - :type resource_id: str - :param key: The key of the bound resource. - :type key: str - :param binding_parameters: Binding parameters of the Binding resource. - :type binding_parameters: dict[str, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -422,6 +483,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -442,12 +511,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -495,6 +564,14 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -519,8 +596,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties """ _validation = { @@ -542,6 +619,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -549,10 +630,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -567,6 +648,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -575,17 +662,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -604,6 +691,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -621,8 +721,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -648,6 +748,10 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -660,27 +764,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -715,6 +819,29 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -737,10 +864,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerState - :param error: Error when apply config server settings. - :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :param config_server: Settings of config server. - :type config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings """ _validation = { @@ -760,6 +887,13 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -777,8 +911,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties """ _validation = { @@ -800,6 +934,11 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -807,8 +946,9 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :param git_property: Property of git environment. - :type git_property: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -821,6 +961,11 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -828,12 +973,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record. - :type name: str - :param uri: The uri of the config server settings error record. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -850,6 +995,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -859,10 +1012,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -878,6 +1031,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -888,12 +1048,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param thumbprint: The thumbprint of bound certificate. - :type thumbprint: str + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -913,6 +1073,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -930,8 +1096,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties """ _validation = { @@ -953,6 +1119,11 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -960,10 +1131,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -978,6 +1149,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -988,8 +1165,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -1006,6 +1183,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1013,10 +1194,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -1031,6 +1212,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1073,6 +1260,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1092,11 +1281,11 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource. - :type properties: + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -1120,6 +1309,13 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1128,11 +1324,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1147,6 +1343,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1157,12 +1360,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -1207,6 +1410,13 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1221,20 +1431,21 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :type cpu: int - :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :vartype cpu: int + :ivar memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard tier should be in range (1, 8). - :type memory_in_gb: int - :param jvm_options: JVM parameter. - :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative to zip root. - :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype memory_in_gb: int + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :type runtime_version: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1257,6 +1468,23 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): + """ + :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), + standard tier should be in range (1, 8). + :paramtype memory_in_gb: int + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1269,10 +1497,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1287,6 +1515,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1297,28 +1531,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1356,6 +1590,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1375,8 +1633,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1393,6 +1651,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1400,12 +1662,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1422,6 +1684,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1431,13 +1701,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1454,6 +1724,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1463,13 +1742,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1486,6 +1765,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1495,31 +1783,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: Unit that makes sense for the metric. - :type unit: str - :param category: Name of the metric category that the metric belongs to. A metric can only + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types. - :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric. - :type dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] - :param source_mdm_namespace: Name of the MDM namespace. Optional. - :type source_mdm_namespace: str + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1552,6 +1840,33 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1575,20 +1890,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingState - :param error: Error when apply Monitoring Setting changes. - :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated + since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate + if monitoringSettings enabled or not. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application insight agent. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1616,6 +1931,23 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1636,8 +1968,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource. - :type properties: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties """ @@ -1660,6 +1992,11 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -1667,12 +2004,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1689,6 +2026,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1700,10 +2045,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1723,6 +2068,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -1733,20 +2084,19 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfileOutboundIPs @@ -1780,6 +2130,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -1811,6 +2177,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1818,22 +2186,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: Display of the operation. - :type display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :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.appplatform.v2020_11_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1848,10 +2226,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :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.appplatform.v2020_11_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -1859,14 +2250,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :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 = { @@ -1885,6 +2276,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1895,8 +2296,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification """ @@ -1910,6 +2311,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1919,12 +2325,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -1945,6 +2351,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -1956,9 +2368,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: "Primary", + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType + :vartype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType """ _validation = { @@ -1975,6 +2387,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2017,6 +2434,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2028,23 +2447,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :param tier: Gets the tier of SKU. - :type tier: str - :param capacity: Gets the capacity of SKU. - :type capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity - :param locations: Gets the set of locations that the SKU is available. - :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in those locations where + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype location_info: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] """ @@ -2070,6 +2489,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2083,10 +2522,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2101,6 +2540,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2109,11 +2554,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2128,6 +2573,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2136,12 +2588,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU. - :type location: str - :param zones: Gets list of availability zones where the SKU is supported. - :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in specific zones. - :type zone_details: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] """ @@ -2159,6 +2611,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2168,10 +2629,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted. - :type locations: list[str] - :param zones: Gets list of availability zones where the SKU is restricted. - :type zones: list[str] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2186,6 +2647,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2194,21 +2661,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to + :ivar values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2228,6 +2695,24 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2238,12 +2723,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :param name: Gets the set of zones that the SKU is available in with the + :ivar name: Gets the set of zones that the SKU is available in with the specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] """ @@ -2259,6 +2744,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2267,10 +2761,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2285,6 +2779,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2301,11 +2801,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2329,6 +2829,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2345,15 +2852,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - :param properties: Properties of the Service resource. - :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource. - :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -2381,6 +2889,18 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2389,11 +2909,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2408,6 +2928,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2416,11 +2943,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] """ @@ -2436,6 +2963,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2444,12 +2979,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2466,6 +3001,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2477,15 +3020,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :type maximum: int - :param default: Gets or sets the default. - :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType + :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType """ _validation = { @@ -2508,6 +3051,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2518,15 +3072,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2543,6 +3097,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -2552,10 +3118,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB. - :type size_in_gb: int - :param mount_path: Mount path of the temporary disk. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2574,6 +3140,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -2582,16 +3154,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2612,6 +3184,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2623,17 +3207,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source". - :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param version: Version of the source. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :type artifact_selector: str + :vartype artifact_selector: str """ _attribute_map = { @@ -2652,6 +3236,19 @@ def __init__( artifact_selector: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source". + :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py index 2b9bcb3d68b..9827c7a11de 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,319 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +342,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - sync_status=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -65,7 +360,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,31 +372,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,50 +405,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -177,17 +465,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -201,14 +491,20 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -222,28 +518,22 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -253,46 +543,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,16 +588,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,14 +610,17 @@ def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -343,25 +633,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -371,52 +654,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -433,17 +711,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -457,14 +737,20 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -478,28 +764,22 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -509,17 +789,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.AppResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -528,45 +808,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -575,7 +858,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,19 +871,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace def get_resource_upload_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -616,29 +904,26 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -651,17 +936,19 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace def validate_domain( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -672,7 +959,8 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult @@ -683,34 +971,30 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -723,4 +1007,6 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py index d2d143d8572..e2701b47109 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.BindingResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py index 0dbefc75ad9..4ff2be51467 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,185 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +208,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +235,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +267,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,17 +327,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,17 +350,24 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -217,28 +381,22 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,46 +406,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -297,16 +451,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,14 +473,17 @@ def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,25 +496,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,17 +517,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateResourceCollection"]: """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -385,45 +536,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -432,7 +586,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +599,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py index dd9d73e3d8a..346ea8f011e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,194 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +217,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +241,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +272,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +327,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +347,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -203,27 +377,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +402,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +457,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +477,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -334,27 +507,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,50 +532,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _validate_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -424,16 +587,18 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace def begin_validate( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -442,17 +607,24 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,27 +637,22 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -495,6 +662,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py index 9981f525763..62862ed6d0f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainResourceCollection"]: """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py index d88630d9689..e5e73f78555 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,445 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,15 +468,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +498,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +531,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +593,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -202,17 +619,24 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -227,29 +651,22 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +676,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +723,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +748,17 @@ def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +772,18 @@ def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +793,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +852,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -472,17 +878,24 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -497,29 +910,22 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,19 +935,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,51 +957,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,7 +1014,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,19 +1027,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, - resource_group_name, # type: str - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -633,50 +1048,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -685,7 +1103,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -694,49 +1116,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -746,17 +1165,18 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + - def begin_start( + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,14 +1190,17 @@ def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,26 +1214,18 @@ def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -820,48 +1235,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - def _stop_initial( + def _stop_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -871,17 +1282,18 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - def begin_stop( + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,14 +1307,17 @@ def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -916,26 +1331,18 @@ def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -945,48 +1352,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _restart_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -996,17 +1399,18 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - def begin_restart( + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,14 +1424,17 @@ def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1041,26 +1448,18 @@ def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,19 +1469,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace def get_log_file_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1104,30 +1503,27 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1142,4 +1538,6 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py index a7544e77b78..87a792fc8dd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,150 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +173,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +197,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +228,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +283,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +303,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -203,27 +333,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +358,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +413,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +433,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -334,27 +463,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,6 +488,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py index e93fd2c1410..ae325f2a61c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,47 +73,49 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +137,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py index 5c7e5ce3dc2..1d749404a66 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,49 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,22 +89,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py index 2aa4b23d010..cd97246f694 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,447 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +470,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -71,28 +494,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,48 +525,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,16 +583,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -187,14 +606,20 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -207,27 +632,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -237,44 +657,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -284,15 +700,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,14 +719,17 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -321,24 +741,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,50 +762,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -408,16 +817,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -429,14 +840,20 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -449,27 +866,22 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -479,17 +891,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + @distributed_trace def list_test_keys( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -507,28 +919,25 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,16 +950,18 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace def regenerate_test_key( self, - resource_group_name, # type: str - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -559,7 +970,8 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys @@ -570,33 +982,29 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -609,15 +1017,17 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -635,28 +1045,25 @@ def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -666,15 +1073,16 @@ def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace def enable_test_endpoint( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -692,28 +1100,25 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,21 +1131,24 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace def check_name_availability( self, - location, # type: str - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability @@ -751,32 +1159,28 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -789,53 +1193,55 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -844,7 +1250,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -853,17 +1263,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -871,43 +1282,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -916,7 +1328,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -925,7 +1341,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py index 746347c182f..a3281080aea 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,56 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class SkusOperations(object): """SkusOperations operations. @@ -45,51 +79,52 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,7 +133,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +146,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py index d2ddf950056..41ec6d71ff7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py index 7deee559a53..58dad04d711 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py @@ -6,124 +6,119 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2021_06_01_preview.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2021_06_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2021_06_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2021_06_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2021_06_01_preview.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2021_06_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2021_06_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2021_06_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2021_06_01_preview.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2021_06_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_06_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2021_06_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2021_06_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py index a358948766f..2e1de152bfa 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py index 39f10548873..44ce4a5043f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py index dfc7ace8ede..00782ca3942 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py @@ -6,120 +6,119 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py index 80c22c56c44..fbe7cbe198a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py index 4de955a7168..e4832b4a1e8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -60,7 +65,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -72,31 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,34 +127,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -171,8 +170,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,14 +196,20 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -215,28 +223,22 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -246,11 +248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -262,29 +264,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -294,9 +293,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -314,14 +315,17 @@ async def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,25 +338,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,9 +359,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore async def _update_initial( self, @@ -379,34 +376,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -423,8 +416,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,14 +442,20 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -467,28 +469,22 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -498,10 +494,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -516,45 +513,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,7 +563,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,29 +609,26 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -638,8 +641,11 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -658,7 +664,8 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult @@ -669,34 +676,30 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -709,4 +712,6 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py index b4572f289da..0f2eec3773b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py index 60ac54d7607..f7706159a0d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,17 +189,24 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -210,28 +220,22 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +245,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -257,29 +261,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,9 +290,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -309,14 +312,17 @@ async def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -329,25 +335,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,10 +356,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -375,45 +375,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -422,7 +425,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +438,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py index b032bebe43d..cb88c6e435d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,9 +360,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _validate_initial( self, @@ -371,33 +376,29 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -414,8 +415,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -431,17 +435,24 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -454,27 +465,22 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -484,6 +490,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py index 4c1b197d9f5..5f08b6fde07 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py index ef6fc17c694..7708eb9322b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,17 +198,24 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -220,29 +230,22 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +255,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +272,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +302,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +327,17 @@ async def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +351,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +372,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore async def _update_initial( self, @@ -393,35 +390,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +431,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -461,17 +457,24 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -486,29 +489,22 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +514,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,51 +536,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -592,7 +593,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,11 +606,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -620,50 +627,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -672,7 +682,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,12 +695,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -699,30 +714,27 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -732,9 +744,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + - async def begin_start( + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -755,14 +769,17 @@ async def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -776,26 +793,18 @@ async def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,11 +814,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - async def _stop_initial( + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -822,30 +831,27 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -855,9 +861,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - async def begin_stop( + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -878,14 +886,17 @@ async def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -899,26 +910,18 @@ async def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -928,11 +931,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _restart_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -945,30 +948,27 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,9 +978,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - async def begin_restart( + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1001,14 +1003,17 @@ async def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1022,26 +1027,18 @@ async def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1051,10 +1048,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,30 +1082,27 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1122,4 +1117,6 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py index 49ecf2833cd..a77221d1d11 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,6 +360,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py index 8ccd1eee431..aa02a22d893 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,38 +53,40 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,7 +95,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +108,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py index 1b2936a30aa..5a041d1ced2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,22 +60,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,4 +88,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py index a7d0539bc53..781ed3086c6 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,28 +71,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +102,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -114,33 +118,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,8 +160,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,14 +183,20 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -200,27 +209,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,11 +234,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -245,28 +249,25 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -276,9 +277,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -293,14 +296,17 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -312,24 +318,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore async def _update_initial( self, @@ -355,33 +355,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -398,8 +394,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,14 +417,20 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -438,27 +443,22 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,10 +468,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,28 +496,25 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -529,8 +527,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +547,8 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys @@ -557,33 +559,29 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,9 +594,12 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - async def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -621,28 +622,25 @@ async def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,8 +650,10 @@ async def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,28 +677,25 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,8 +708,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,7 +724,8 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability @@ -735,32 +736,28 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -773,8 +770,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,42 +783,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -827,7 +827,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -836,11 +840,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -853,43 +859,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -898,7 +905,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -907,7 +918,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py index 8ed38802659..587c3832696 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,43 +52,44 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,7 +98,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,7 +111,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py index 4fcc9dd5cc6..63bc9d3ed37 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py @@ -6,154 +6,82 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AppResource - from ._models_py3 import AppResourceCollection - from ._models_py3 import AppResourceProperties - from ._models_py3 import ApplicationInsightsAgentVersions - from ._models_py3 import AvailableOperations - from ._models_py3 import AvailableRuntimeVersions - from ._models_py3 import BindingResource - from ._models_py3 import BindingResourceCollection - from ._models_py3 import BindingResourceProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateResource - from ._models_py3 import CertificateResourceCollection - from ._models_py3 import CloudErrorBody - from ._models_py3 import ClusterResourceProperties - from ._models_py3 import ConfigServerGitProperty - from ._models_py3 import ConfigServerProperties - from ._models_py3 import ConfigServerResource - from ._models_py3 import ConfigServerSettings - from ._models_py3 import ConfigServerSettingsErrorRecord - from ._models_py3 import ConfigServerSettingsValidateResult - from ._models_py3 import CustomContainer - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - from ._models_py3 import ImageRegistryCredential - from ._models_py3 import LogFileUrlResponse - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedIdentityProperties - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import MonitoringSettingProperties - from ._models_py3 import MonitoringSettingResource - from ._models_py3 import NameAvailability - from ._models_py3 import NameAvailabilityParameters - from ._models_py3 import NetworkProfile - from ._models_py3 import NetworkProfileOutboundIPs - from ._models_py3 import OperationDetail - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationProperties - from ._models_py3 import PersistentDisk - from ._models_py3 import ProxyResource - from ._models_py3 import RegenerateTestKeyRequestPayload - from ._models_py3 import RequiredTraffic - from ._models_py3 import Resource - from ._models_py3 import ResourceRequests - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCollection - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkuZoneDetails - from ._models_py3 import ResourceUploadDefinition - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuCapacity - from ._models_py3 import SupportedRuntimeVersion - from ._models_py3 import TemporaryDisk - from ._models_py3 import TestKeys - from ._models_py3 import TrackedResource - from ._models_py3 import UserSourceInfo -except (SyntaxError, ImportError): - from ._models import AppResource # type: ignore - from ._models import AppResourceCollection # type: ignore - from ._models import AppResourceProperties # type: ignore - from ._models import ApplicationInsightsAgentVersions # type: ignore - from ._models import AvailableOperations # type: ignore - from ._models import AvailableRuntimeVersions # type: ignore - from ._models import BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import CustomContainer # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import ImageRegistryCredential # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRequests # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import CustomContainer +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceRequests +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -245,6 +173,7 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py index aa047f451ec..fa72f83379e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -35,7 +26,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -45,7 +36,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -54,7 +45,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -66,7 +57,7 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -75,7 +66,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -84,7 +75,7 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -98,7 +89,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -106,14 +97,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -121,7 +112,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -129,14 +120,14 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -144,21 +135,21 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py index abec200ca32..1cd1bb6ef9e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py @@ -34,6 +34,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -67,6 +69,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -102,6 +106,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -116,12 +122,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource. - :type identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with its parent resource. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -147,6 +153,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -156,11 +172,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -175,6 +191,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -185,28 +208,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App. - :type active_deployment_name: str - :param fqdn: Fully qualified dns Name. - :type fqdn: str - :param https_only: Indicate if only https is allowed. - :type https_only: bool + :ivar active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :param temporary_disk: Temporary disk settings. - :type temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings. - :type persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk - :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :type enable_end_to_end_tls: bool + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool """ _validation = { @@ -240,6 +263,22 @@ def __init__( enable_end_to_end_tls: Optional[bool] = False, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -256,11 +295,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -275,6 +314,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -302,6 +348,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -317,8 +365,9 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties """ _validation = { @@ -340,6 +389,11 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -347,11 +401,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -366,6 +420,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -380,12 +441,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource. - :type resource_id: str - :param key: The key of the bound resource. - :type key: str - :param binding_parameters: Binding parameters of the Binding resource. - :type binding_parameters: dict[str, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -422,6 +483,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -442,12 +511,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -495,6 +564,14 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -519,8 +596,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties """ _validation = { @@ -542,6 +619,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -549,10 +630,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -567,6 +648,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -575,17 +662,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -604,6 +691,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -621,8 +721,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -648,6 +748,10 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -660,27 +764,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -715,6 +819,29 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -737,10 +864,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerState - :param error: Error when apply config server settings. - :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :param config_server: Settings of config server. - :type config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings """ _validation = { @@ -760,6 +887,13 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -777,8 +911,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties """ _validation = { @@ -800,6 +934,11 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -807,8 +946,9 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :param git_property: Property of git environment. - :type git_property: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -821,6 +961,11 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -828,12 +973,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record. - :type name: str - :param uri: The uri of the config server settings error record. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -850,6 +995,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -859,10 +1012,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -878,6 +1031,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -886,19 +1046,19 @@ def __init__( class CustomContainer(msrest.serialization.Model): """Custom container payload. - :param server: The name of the registry that contains the container image. - :type server: str - :param container_image: Container image of the custom container. This should be in the form of + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar container_image: Container image of the custom container. This should be in the form of :code:``::code:`` without the server name of the registry. - :type container_image: str - :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + :vartype container_image: str + :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. - :type command: list[str] - :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not + :vartype command: list[str] + :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not provided. - :type args: list[str] - :param image_registry_credential: Credential of the image registry. - :type image_registry_credential: + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential """ @@ -920,6 +1080,22 @@ def __init__( image_registry_credential: Optional["ImageRegistryCredential"] = None, **kwargs ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential + """ super(CustomContainer, self).__init__(**kwargs) self.server = server self.container_image = container_image @@ -933,12 +1109,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param thumbprint: The thumbprint of bound certificate. - :type thumbprint: str + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -958,6 +1134,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -975,8 +1157,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties """ _validation = { @@ -998,6 +1180,11 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -1005,10 +1192,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -1023,6 +1210,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1033,8 +1226,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -1051,6 +1244,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1058,10 +1255,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -1076,6 +1273,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1118,6 +1321,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1137,11 +1342,11 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource. - :type properties: + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -1165,6 +1370,13 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1173,11 +1385,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1192,6 +1404,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1202,12 +1421,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -1252,6 +1471,13 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1266,27 +1492,28 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + :ivar cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard tier. This is deprecated starting from API version 2021-06-01-preview. Please use the resourceRequests field to set the CPU size. - :type cpu: int - :param memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, + :vartype cpu: int + :ivar memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version 2021-06-01-preview. Please use the resourceRequests field to set the the memory size. - :type memory_in_gb: int - :param resource_requests: The requested resource quantity for required CPU and Memory. It is + :vartype memory_in_gb: int + :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. - :type resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests - :param jvm_options: JVM parameter. - :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative to zip root. - :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :type runtime_version: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1311,6 +1538,31 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): + """ + :keyword cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + tier. This is deprecated starting from API version 2021-06-01-preview. Please use the + resourceRequests field to set the CPU size. + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic + tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version + 2021-06-01-preview. Please use the resourceRequests field to set the the memory size. + :paramtype memory_in_gb: int + :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1324,10 +1576,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1342,6 +1594,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1352,28 +1610,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1411,6 +1669,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1428,10 +1710,10 @@ def __init__( class ImageRegistryCredential(msrest.serialization.Model): """Credential of the image registry. - :param username: The username of the image registry credential. - :type username: str - :param password: The password of the image registry credential. - :type password: str + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str """ _attribute_map = { @@ -1446,6 +1728,12 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = username self.password = password @@ -1456,8 +1744,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1474,6 +1762,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1481,12 +1773,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1503,6 +1795,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1512,13 +1812,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1535,6 +1835,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1544,13 +1853,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1567,6 +1876,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1576,31 +1894,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: Unit that makes sense for the metric. - :type unit: str - :param category: Name of the metric category that the metric belongs to. A metric can only + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types. - :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric. - :type dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] - :param source_mdm_namespace: Name of the MDM namespace. Optional. - :type source_mdm_namespace: str + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -1633,6 +1951,33 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1656,20 +2001,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingState - :param error: Error when apply Monitoring Setting changes. - :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated + since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate + if monitoringSettings enabled or not. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application insight agent. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1697,6 +2042,23 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1717,8 +2079,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource. - :type properties: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties """ @@ -1741,6 +2103,11 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -1748,12 +2115,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -1770,6 +2137,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1781,10 +2156,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -1804,6 +2179,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -1814,20 +2195,19 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfileOutboundIPs @@ -1861,6 +2241,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -1892,6 +2288,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -1899,22 +2297,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: Display of the operation. - :type display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :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.appplatform.v2021_06_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -1929,10 +2337,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :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.appplatform.v2021_06_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -1940,14 +2361,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :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 = { @@ -1966,6 +2387,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1976,8 +2407,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification """ @@ -1991,6 +2422,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2000,12 +2436,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -2026,6 +2462,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -2037,9 +2479,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: "Primary", + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType + :vartype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType """ _validation = { @@ -2056,6 +2498,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2098,6 +2545,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2109,12 +2558,12 @@ def __init__( class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :type cpu: str - :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :type memory: str + :vartype cpu: str + :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, + 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :vartype memory: str """ _attribute_map = { @@ -2129,6 +2578,14 @@ def __init__( memory: Optional[str] = None, **kwargs ): + """ + :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 + for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :paramtype cpu: str + :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :paramtype memory: str + """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -2137,23 +2594,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :param tier: Gets the tier of SKU. - :type tier: str - :param capacity: Gets the capacity of SKU. - :type capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity - :param locations: Gets the set of locations that the SKU is available. - :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in those locations where + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype location_info: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] """ @@ -2179,6 +2636,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2192,10 +2669,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2210,6 +2687,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2218,11 +2701,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2237,6 +2720,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2245,12 +2735,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU. - :type location: str - :param zones: Gets list of availability zones where the SKU is supported. - :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in specific zones. - :type zone_details: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] """ @@ -2268,6 +2758,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2277,10 +2776,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted. - :type locations: list[str] - :param zones: Gets list of availability zones where the SKU is restricted. - :type zones: list[str] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2295,6 +2794,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2303,21 +2808,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to + :ivar values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2337,6 +2842,24 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2347,12 +2870,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :param name: Gets the set of zones that the SKU is available in with the + :ivar name: Gets the set of zones that the SKU is available in with the specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] """ @@ -2368,6 +2891,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2376,10 +2908,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2394,6 +2926,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2410,11 +2948,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2438,6 +2976,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2454,15 +2999,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - :param properties: Properties of the Service resource. - :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource. - :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -2490,6 +3036,18 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2498,11 +3056,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2517,6 +3075,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2525,11 +3090,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] """ @@ -2545,6 +3110,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2553,12 +3126,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2575,6 +3148,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2586,15 +3167,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :type maximum: int - :param default: Gets or sets the default. - :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType + :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType """ _validation = { @@ -2617,6 +3198,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2627,15 +3219,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -2652,6 +3244,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -2661,10 +3265,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB. - :type size_in_gb: int - :param mount_path: Mount path of the temporary disk. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -2683,6 +3287,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -2691,16 +3301,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -2721,6 +3331,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -2732,19 +3354,19 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source", "Container". - :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param version: Version of the source. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :type artifact_selector: str - :param custom_container: Custom container payload. - :type custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer + :vartype artifact_selector: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer """ _attribute_map = { @@ -2765,6 +3387,21 @@ def __init__( custom_container: Optional["CustomContainer"] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py index eea853d9933..495ec7d7c6f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,319 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +342,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - sync_status=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -65,7 +360,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,31 +372,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,50 +405,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -177,17 +465,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -201,14 +491,20 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -222,28 +518,22 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -253,46 +543,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,16 +588,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,14 +610,17 @@ def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -343,25 +633,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -371,52 +654,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -433,17 +711,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -457,14 +737,20 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -478,28 +764,22 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -509,17 +789,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.AppResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -528,45 +808,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -575,7 +858,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,19 +871,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace def get_resource_upload_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -616,29 +904,26 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -651,17 +936,19 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace def validate_domain( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -672,7 +959,8 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult @@ -683,34 +971,30 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -723,4 +1007,6 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py index 055f8f16cc1..4bca4feeddd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.BindingResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py index 51ba407eef8..a2400cb2ad9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,185 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +208,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +235,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +267,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,17 +327,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,17 +350,24 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -217,28 +381,22 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,46 +406,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -297,16 +451,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,14 +473,17 @@ def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,25 +496,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,17 +517,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateResourceCollection"]: """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -385,45 +536,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -432,7 +586,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +599,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py index aba3e06c24d..be6583d00cf 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,194 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +217,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +241,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +272,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +327,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +347,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -203,27 +377,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +402,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +457,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +477,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -334,27 +507,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,50 +532,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _validate_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -424,16 +587,18 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace def begin_validate( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -442,17 +607,24 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,27 +637,22 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -495,6 +662,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py index e7e4cafb94e..5811473a259 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainResourceCollection"]: """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py index 0c1fe5d247f..878dba4ee93 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,445 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -47,15 +468,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +498,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +531,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +593,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -202,17 +619,24 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -227,29 +651,22 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +676,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +723,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +748,17 @@ def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +772,18 @@ def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +793,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +852,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -472,17 +878,24 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -497,29 +910,22 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,19 +935,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,51 +957,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,7 +1014,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,19 +1027,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, - resource_group_name, # type: str - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -633,50 +1048,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -685,7 +1103,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -694,49 +1116,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -746,17 +1165,18 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + - def begin_start( + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,14 +1190,17 @@ def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,26 +1214,18 @@ def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -820,48 +1235,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - def _stop_initial( + def _stop_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -871,17 +1282,18 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - def begin_stop( + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,14 +1307,17 @@ def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -916,26 +1331,18 @@ def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -945,48 +1352,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _restart_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -996,17 +1399,18 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - def begin_restart( + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,14 +1424,17 @@ def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1041,26 +1448,18 @@ def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,19 +1469,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace def get_log_file_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1104,30 +1503,27 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1142,4 +1538,6 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py index 4b278909b72..405aed124cf 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,150 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +173,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +197,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +228,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +283,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +303,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -203,27 +333,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +358,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +413,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +433,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -334,27 +463,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,6 +488,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py index 3a411f52957..6fcbd324a4d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,47 +73,49 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +137,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py index 26067aebd4f..0a7e191e140 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,49 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,22 +89,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py index ec19c6b6bc1..d4bc50e58e2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,447 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +470,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -71,28 +494,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,48 +525,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,16 +583,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -187,14 +606,20 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -207,27 +632,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -237,44 +657,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -284,15 +700,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,14 +719,17 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -321,24 +741,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,50 +762,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -408,16 +817,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -429,14 +840,20 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -449,27 +866,22 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -479,17 +891,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + @distributed_trace def list_test_keys( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -507,28 +919,25 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,16 +950,18 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace def regenerate_test_key( self, - resource_group_name, # type: str - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -559,7 +970,8 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys @@ -570,33 +982,29 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -609,15 +1017,17 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -635,28 +1045,25 @@ def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -666,15 +1073,16 @@ def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace def enable_test_endpoint( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -692,28 +1100,25 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,21 +1131,24 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace def check_name_availability( self, - location, # type: str - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability @@ -751,32 +1159,28 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -789,53 +1193,55 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -844,7 +1250,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -853,17 +1263,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -871,43 +1282,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -916,7 +1328,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -925,7 +1341,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py index 8ebe4102035..aa37e824b96 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,56 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class SkusOperations(object): """SkusOperations operations. @@ -45,51 +79,52 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,7 +133,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +146,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py index d2ddf950056..41ec6d71ff7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py index 2f120a460b9..a2e6e673b5e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py @@ -6,43 +6,33 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import StoragesOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations, StoragesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_09_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2021_09_01_preview.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2021_09_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2021_09_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2021_09_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_09_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -50,85 +40,88 @@ class AppPlatformManagementClient(object): :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2021_09_01_preview.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2021_09_01_preview.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2021_09_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2021_09_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2021_09_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2021_09_01_preview.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2021_09_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_09_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2021_09_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2021_09_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_09_01_preview.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py index e3b3c943b4e..39fcf5f8106 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py index e5754a47ce6..92453d8691d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" +VERSION = "6.1.0" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py index 39f10548873..44ce4a5043f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py index c8694042146..7510f58ba56 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py @@ -6,41 +6,33 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import StoragesOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations, StoragesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -48,83 +40,88 @@ class AppPlatformManagementClient(object): :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py index 987657fd65f..15ee10bc893 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py index 6aa56a5cb40..32287620c0c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -60,7 +65,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -72,31 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,34 +127,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -171,8 +170,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,14 +196,20 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -215,28 +223,22 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -246,11 +248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -262,29 +264,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -294,9 +293,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -314,14 +315,17 @@ async def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,25 +338,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,9 +359,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore async def _update_initial( self, @@ -379,34 +376,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -423,8 +416,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,14 +442,20 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -467,28 +469,22 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -498,10 +494,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -516,45 +513,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,7 +563,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,29 +609,26 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -638,8 +641,11 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -658,7 +664,8 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult @@ -669,34 +676,30 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -709,4 +712,6 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py index e04b1377962..a025d57361c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py index da8a9ebd586..4bce9de5415 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,17 +189,24 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -210,28 +220,22 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +245,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -257,29 +261,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,9 +290,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -309,14 +312,17 @@ async def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -329,25 +335,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,10 +356,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -375,45 +375,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -422,7 +425,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +438,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py index 0a9e48f21c0..eb9e2089344 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,9 +360,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _validate_initial( self, @@ -371,33 +376,29 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -414,8 +415,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -431,17 +435,24 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -454,27 +465,22 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -484,6 +490,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py index d177c42ecfb..b3339004bb0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py index 5b7627bab92..aa308ba024c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DeploymentsOperations: +class DeploymentsOperations: # pylint: disable=too-many-public-methods """DeploymentsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,17 +198,24 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -220,29 +230,22 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +255,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +272,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +302,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +327,17 @@ async def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +351,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +372,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore async def _update_initial( self, @@ -393,35 +390,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +431,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -461,17 +457,24 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -486,29 +489,22 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +514,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,51 +536,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -592,7 +593,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,11 +606,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -620,50 +627,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -672,7 +682,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,12 +695,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -699,30 +714,27 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -732,9 +744,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - async def begin_start( + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -755,14 +769,17 @@ async def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -776,26 +793,18 @@ async def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,11 +814,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _stop_initial( + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -822,30 +831,27 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -855,9 +861,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - async def begin_stop( + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -878,14 +886,17 @@ async def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -899,26 +910,18 @@ async def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -928,11 +931,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -945,30 +948,27 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,9 +978,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + - async def begin_restart( + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1001,14 +1003,17 @@ async def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1022,26 +1027,18 @@ async def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1051,10 +1048,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,30 +1082,27 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1122,9 +1117,11 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - async def _generate_heap_dump_initial( + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1138,35 +1135,31 @@ async def _generate_heap_dump_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_heap_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1176,9 +1169,11 @@ async def _generate_heap_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - async def begin_generate_heap_dump( + + @distributed_trace_async + async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1199,17 +1194,22 @@ async def begin_generate_heap_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1224,26 +1224,19 @@ async def begin_generate_heap_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1253,11 +1246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _generate_thread_dump_initial( + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1271,35 +1264,31 @@ async def _generate_thread_dump_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_thread_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1309,9 +1298,11 @@ async def _generate_thread_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + - async def begin_generate_thread_dump( + @distributed_trace_async + async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1332,17 +1323,22 @@ async def begin_generate_thread_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1357,26 +1353,19 @@ async def begin_generate_thread_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1386,11 +1375,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - async def _start_jfr_initial( + async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1404,35 +1393,31 @@ async def _start_jfr_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._start_jfr_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1442,9 +1427,11 @@ async def _start_jfr_initial( if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore - async def begin_start_jfr( + + @distributed_trace_async + async def begin_start_jfr( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1465,17 +1452,22 @@ async def begin_start_jfr( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1490,26 +1482,19 @@ async def begin_start_jfr( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1519,6 +1504,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py index a5fc03172e4..53bd1b1ea59 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,6 +360,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py index 4e200df142c..2cb744db303 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,38 +53,40 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,7 +95,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +108,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py index aed78e05840..e5c15de66f4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,22 +60,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,4 +88,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py index 61df1387172..2db37f6e3f7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,28 +71,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +102,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -114,33 +118,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,8 +160,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,14 +183,20 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -200,27 +209,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,11 +234,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -245,28 +249,25 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -276,9 +277,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -293,14 +296,17 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -312,24 +318,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore async def _update_initial( self, @@ -355,33 +355,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -398,8 +394,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,14 +417,20 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -438,27 +443,22 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,10 +468,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,28 +496,25 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -529,8 +527,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +547,8 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys @@ -557,33 +559,29 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,9 +594,12 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - async def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -621,28 +622,25 @@ async def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,8 +650,10 @@ async def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,28 +677,25 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,9 +708,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - async def _stop_initial( + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -724,28 +723,25 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -755,9 +751,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + - async def begin_stop( + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -772,14 +770,17 @@ async def begin_stop( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,24 +792,18 @@ async def begin_stop( raw_result = await self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -818,11 +813,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _start_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -833,28 +828,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -864,9 +856,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + - async def begin_start( + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -881,14 +875,17 @@ async def begin_start( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -900,24 +897,18 @@ async def begin_start( raw_result = await self._start_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -927,10 +918,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -942,7 +934,8 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability @@ -953,32 +946,28 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -991,8 +980,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -1001,42 +993,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1045,7 +1037,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1054,11 +1050,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -1071,43 +1069,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1116,7 +1115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1125,7 +1128,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py index f89076c649b..69130ae774a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,43 +52,44 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,7 +98,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,7 +111,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py index e470058c3ec..e8f8d2a5f3b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storages_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_resource, 'StorageResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,14 +192,20 @@ async def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -210,28 +219,22 @@ async def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +244,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -257,29 +260,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,9 +289,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -309,14 +311,17 @@ async def begin_delete( :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -329,25 +334,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,10 +355,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -375,45 +374,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageResourceCollection', pipeline_response) + deserialized = self._deserialize("StorageResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -422,7 +424,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +437,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py index 8bde0d949a7..169c88204eb 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py @@ -6,180 +6,95 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AppResource - from ._models_py3 import AppResourceCollection - from ._models_py3 import AppResourceProperties - from ._models_py3 import ApplicationInsightsAgentVersions - from ._models_py3 import AvailableOperations - from ._models_py3 import AvailableRuntimeVersions - from ._models_py3 import AzureFileVolume - from ._models_py3 import BindingResource - from ._models_py3 import BindingResourceCollection - from ._models_py3 import BindingResourceProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateResource - from ._models_py3 import CertificateResourceCollection - from ._models_py3 import CloudErrorBody - from ._models_py3 import ClusterResourceProperties - from ._models_py3 import ConfigServerGitProperty - from ._models_py3 import ConfigServerProperties - from ._models_py3 import ConfigServerResource - from ._models_py3 import ConfigServerSettings - from ._models_py3 import ConfigServerSettingsErrorRecord - from ._models_py3 import ConfigServerSettingsValidateResult - from ._models_py3 import ContentCertificateProperties - from ._models_py3 import CustomContainer - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import CustomPersistentDiskProperties - from ._models_py3 import CustomPersistentDiskResource - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import DeploymentSettingsContainerProbeSettings - from ._models_py3 import DiagnosticParameters - from ._models_py3 import Error - from ._models_py3 import GitPatternRepository - from ._models_py3 import ImageRegistryCredential - from ._models_py3 import KeyVaultCertificateProperties - from ._models_py3 import LoadedCertificate - from ._models_py3 import LogFileUrlResponse - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedIdentityProperties - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import MonitoringSettingProperties - from ._models_py3 import MonitoringSettingResource - from ._models_py3 import NameAvailability - from ._models_py3 import NameAvailabilityParameters - from ._models_py3 import NetworkProfile - from ._models_py3 import NetworkProfileOutboundIPs - from ._models_py3 import OperationDetail - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationProperties - from ._models_py3 import PersistentDisk - from ._models_py3 import ProxyResource - from ._models_py3 import RegenerateTestKeyRequestPayload - from ._models_py3 import RequiredTraffic - from ._models_py3 import Resource - from ._models_py3 import ResourceRequests - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCollection - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkuZoneDetails - from ._models_py3 import ResourceUploadDefinition - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuCapacity - from ._models_py3 import StorageAccount - from ._models_py3 import StorageProperties - from ._models_py3 import StorageResource - from ._models_py3 import StorageResourceCollection - from ._models_py3 import SupportedRuntimeVersion - from ._models_py3 import SystemData - from ._models_py3 import TemporaryDisk - from ._models_py3 import TestKeys - from ._models_py3 import TrackedResource - from ._models_py3 import UserSourceInfo -except (SyntaxError, ImportError): - from ._models import AppResource # type: ignore - from ._models import AppResourceCollection # type: ignore - from ._models import AppResourceProperties # type: ignore - from ._models import ApplicationInsightsAgentVersions # type: ignore - from ._models import AvailableOperations # type: ignore - from ._models import AvailableRuntimeVersions # type: ignore - from ._models import AzureFileVolume # type: ignore - from ._models import BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import ContentCertificateProperties # type: ignore - from ._models import CustomContainer # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import CustomPersistentDiskProperties # type: ignore - from ._models import CustomPersistentDiskResource # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import DeploymentSettingsContainerProbeSettings # type: ignore - from ._models import DiagnosticParameters # type: ignore - from ._models import Error # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import ImageRegistryCredential # type: ignore - from ._models import KeyVaultCertificateProperties # type: ignore - from ._models import LoadedCertificate # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRequests # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageProperties # type: ignore - from ._models import StorageResource # type: ignore - from ._models import StorageResourceCollection # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import SystemData # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UserSourceInfo # type: ignore +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import AzureFileVolume +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import ContentCertificateProperties +from ._models_py3 import CustomContainer +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import CustomPersistentDiskProperties +from ._models_py3 import CustomPersistentDiskResource +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import DeploymentSettingsContainerProbeSettings +from ._models_py3 import DiagnosticParameters +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import KeyVaultCertificateProperties +from ._models_py3 import LoadedCertificate +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceRequests +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import StorageAccount +from ._models_py3 import StorageProperties +from ._models_py3 import StorageResource +from ._models_py3 import StorageResourceCollection +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import SystemData +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import UserSourceInfo + from ._app_platform_management_client_enums import ( + ActionType, AppResourceProvisioningState, ConfigServerState, CreatedByType, @@ -193,10 +108,12 @@ ResourceSkuRestrictionsType, RuntimeVersion, SkuScaleType, + StorageType, SupportedRuntimePlatform, SupportedRuntimeValue, TestKeyType, TrafficDirection, + Type, UserSourceType, ) @@ -286,6 +203,7 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', + 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'CreatedByType', @@ -299,9 +217,11 @@ 'ResourceSkuRestrictionsType', 'RuntimeVersion', 'SkuScaleType', + 'StorageType', 'SupportedRuntimePlatform', 'SupportedRuntimeValue', 'TestKeyType', 'TrafficDirection', + 'Type', 'UserSourceType', ] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py index 4f163172137..8a48df4eabc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -35,7 +26,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -45,7 +36,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -54,7 +45,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -63,7 +54,7 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -75,7 +66,7 @@ class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -84,7 +75,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -93,19 +84,21 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class PowerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PowerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Power state of the Service """ RUNNING = "Running" STOPPED = "Stopped" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ CREATING = "Creating" UPDATING = "Updating" + STARTING = "Starting" + STOPPING = "Stopping" DELETING = "Deleting" DELETED = "Deleted" SUCCEEDED = "Succeeded" @@ -114,7 +107,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -122,14 +115,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -137,7 +130,7 @@ class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -145,14 +138,20 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the storage. + """ + + STORAGE_ACCOUNT = "StorageAccount" + +class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -160,21 +159,27 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the underlying resource to mount as a persistent disk. + """ + + AZURE_FILE_VOLUME = "AzureFileVolume" + +class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py index 630434ecd0f..a3645379c04 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py @@ -35,6 +35,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -68,6 +70,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -103,6 +107,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -117,12 +123,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the App resource. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource. - :type identity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with its parent resource. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -148,6 +154,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -157,11 +173,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -176,6 +192,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -186,33 +209,33 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProvisioningState - :param active_deployment_name: Name of the active deployment of the App. - :type active_deployment_name: str - :param fqdn: Fully qualified dns Name. - :type fqdn: str - :param https_only: Indicate if only https is allowed. - :type https_only: bool + :ivar active_deployment_name: Name of the active deployment of the App. + :vartype active_deployment_name: str + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :param temporary_disk: Temporary disk settings. - :type temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings. - :type persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk - :param custom_persistent_disks: List of custom persistent disks. - :type custom_persistent_disks: + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] - :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :type enable_end_to_end_tls: bool - :param loaded_certificates: Collection of loaded certificates. - :type loaded_certificates: + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool + :ivar loaded_certificates: Collection of loaded certificates. + :vartype loaded_certificates: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] """ @@ -251,6 +274,28 @@ def __init__( loaded_certificates: Optional[List["LoadedCertificate"]] = None, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword active_deployment_name: Name of the active deployment of the App. + :paramtype active_deployment_name: str + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + :keyword loaded_certificates: Collection of loaded certificates. + :paramtype loaded_certificates: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -269,11 +314,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -288,6 +333,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -315,6 +367,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -327,15 +381,15 @@ class CustomPersistentDiskProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. - :type type: str - :param mount_path: Required. The mount path of the persistent disk. - :type mount_path: str - :param read_only: Indicates whether the persistent disk is a readOnly one. - :type read_only: bool - :param mount_options: These are the mount options for a persistent disk. - :type mount_options: list[str] + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.Type + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] """ _validation = { @@ -362,6 +416,14 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + """ super(CustomPersistentDiskProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.mount_path = mount_path @@ -374,17 +436,17 @@ class AzureFileVolume(CustomPersistentDiskProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. - :type type: str - :param mount_path: Required. The mount path of the persistent disk. - :type mount_path: str - :param read_only: Indicates whether the persistent disk is a readOnly one. - :type read_only: bool - :param mount_options: These are the mount options for a persistent disk. - :type mount_options: list[str] - :param share_name: Required. The share name of the Azure File share. - :type share_name: str + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.Type + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + :ivar share_name: Required. The share name of the Azure File share. + :vartype share_name: str """ _validation = { @@ -410,6 +472,16 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + :keyword share_name: Required. The share name of the Azure File share. + :paramtype share_name: str + """ super(AzureFileVolume, self).__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) self.type = 'AzureFileVolume' # type: str self.share_name = share_name @@ -426,8 +498,9 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties """ _validation = { @@ -449,6 +522,11 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -456,11 +534,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -475,6 +553,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -489,12 +574,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource. - :type resource_id: str - :param key: The key of the bound resource. - :type key: str - :param binding_parameters: Binding parameters of the Binding resource. - :type binding_parameters: dict[str, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -531,6 +616,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -552,8 +645,8 @@ class CertificateProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the certificate source.Constant filled by server. - :type type: str + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -600,6 +693,8 @@ def __init__( self, **kwargs ): + """ + """ super(CertificateProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.thumbprint = None @@ -622,8 +717,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties """ _validation = { @@ -645,6 +740,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -652,10 +751,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -670,6 +769,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -678,17 +783,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -707,6 +812,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -720,12 +838,12 @@ class ClusterResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Provisioning state of the Service. Possible values include: - "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", - "MoveFailed". + "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", + "Moving", "Moved", "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -755,6 +873,10 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -768,27 +890,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -823,6 +945,29 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -845,10 +990,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerState - :param error: Error when apply config server settings. - :type error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error - :param config_server: Settings of config server. - :type config_server: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings """ _validation = { @@ -868,6 +1013,13 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -885,8 +1037,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties """ _validation = { @@ -908,6 +1060,11 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -915,8 +1072,9 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :param git_property: Property of git environment. - :type git_property: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -929,6 +1087,11 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -936,12 +1099,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record. - :type name: str - :param uri: The uri of the config server settings error record. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -958,6 +1121,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -967,10 +1138,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -986,6 +1157,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -998,8 +1176,8 @@ class ContentCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the certificate source.Constant filled by server. - :type type: str + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -1014,8 +1192,8 @@ class ContentCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :param content: Required. The content of uploaded certificate. - :type content: str + :ivar content: The content of uploaded certificate. + :vartype content: str """ _validation = { @@ -1027,7 +1205,6 @@ class ContentCertificateProperties(CertificateProperties): 'activate_date': {'readonly': True}, 'subject_name': {'readonly': True}, 'dns_names': {'readonly': True}, - 'content': {'required': True}, } _attribute_map = { @@ -1045,9 +1222,13 @@ class ContentCertificateProperties(CertificateProperties): def __init__( self, *, - content: str, + content: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of uploaded certificate. + :paramtype content: str + """ super(ContentCertificateProperties, self).__init__(**kwargs) self.type = 'ContentCertificate' # type: str self.content = content @@ -1056,19 +1237,19 @@ def __init__( class CustomContainer(msrest.serialization.Model): """Custom container payload. - :param server: The name of the registry that contains the container image. - :type server: str - :param container_image: Container image of the custom container. This should be in the form of + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar container_image: Container image of the custom container. This should be in the form of :code:``::code:`` without the server name of the registry. - :type container_image: str - :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + :vartype container_image: str + :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. - :type command: list[str] - :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not + :vartype command: list[str] + :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not provided. - :type args: list[str] - :param image_registry_credential: Credential of the image registry. - :type image_registry_credential: + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ImageRegistryCredential """ @@ -1090,6 +1271,22 @@ def __init__( image_registry_credential: Optional["ImageRegistryCredential"] = None, **kwargs ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ImageRegistryCredential + """ super(CustomContainer, self).__init__(**kwargs) self.server = server self.container_image = container_image @@ -1103,12 +1300,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param thumbprint: The thumbprint of bound certificate. - :type thumbprint: str + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -1128,6 +1325,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -1145,8 +1348,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties """ _validation = { @@ -1168,6 +1371,11 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -1175,10 +1383,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -1193,6 +1401,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1203,8 +1417,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -1221,6 +1435,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1228,10 +1446,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -1246,6 +1464,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1256,12 +1480,12 @@ class CustomPersistentDiskResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param custom_persistent_disk_properties: Properties of the custom persistent disk resource + :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource payload. - :type custom_persistent_disk_properties: + :vartype custom_persistent_disk_properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties - :param storage_id: Required. The resource id of Azure Spring Cloud Storage resource. - :type storage_id: str + :ivar storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :vartype storage_id: str """ _validation = { @@ -1280,6 +1504,14 @@ def __init__( custom_persistent_disk_properties: Optional["CustomPersistentDiskProperties"] = None, **kwargs ): + """ + :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :paramtype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties + :keyword storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :paramtype storage_id: str + """ super(CustomPersistentDiskResource, self).__init__(**kwargs) self.custom_persistent_disk_properties = custom_persistent_disk_properties self.storage_id = storage_id @@ -1322,6 +1554,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1341,11 +1575,11 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Deployment resource. - :type properties: + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku """ _validation = { @@ -1369,6 +1603,13 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1377,11 +1618,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1396,6 +1637,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1406,12 +1654,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -1456,6 +1704,13 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettings + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1470,29 +1725,30 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + :ivar cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard tier. This is deprecated starting from API version 2021-09-01-preview. Please use the resourceRequests field to set the CPU size. - :type cpu: int - :param memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, + :vartype cpu: int + :ivar memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version 2021-09-01-preview. Please use the resourceRequests field to set the the memory size. - :type memory_in_gb: int - :param resource_requests: The requested resource quantity for required CPU and Memory. It is + :vartype memory_in_gb: int + :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. - :type resource_requests: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests - :param jvm_options: JVM parameter. - :type jvm_options: str - :param net_core_main_entry_path: The path to the .NET executable relative to zip root. - :type net_core_main_entry_path: str - :param environment_variables: Collection of environment variables. - :type environment_variables: dict[str, str] - :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :vartype resource_requests: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :type runtime_version: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion - :param container_probe_settings: Container liveness and readiness probe settings. - :type container_probe_settings: + :vartype runtime_version: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings """ @@ -1520,6 +1776,34 @@ def __init__( container_probe_settings: Optional["DeploymentSettingsContainerProbeSettings"] = None, **kwargs ): + """ + :keyword cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + tier. This is deprecated starting from API version 2021-09-01-preview. Please use the + resourceRequests field to set the CPU size. + :paramtype cpu: int + :keyword memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic + tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version + 2021-09-01-preview. Please use the resourceRequests field to set the the memory size. + :paramtype memory_in_gb: int + :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + "NetCore_31". Default value: "Java_8". + :paramtype runtime_version: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings + """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1534,8 +1818,8 @@ def __init__( class DeploymentSettingsContainerProbeSettings(msrest.serialization.Model): """Container liveness and readiness probe settings. - :param disable_probe: Indicates whether disable the liveness and readiness probe. - :type disable_probe: bool + :ivar disable_probe: Indicates whether disable the liveness and readiness probe. + :vartype disable_probe: bool """ _attribute_map = { @@ -1548,6 +1832,10 @@ def __init__( disable_probe: Optional[bool] = None, **kwargs ): + """ + :keyword disable_probe: Indicates whether disable the liveness and readiness probe. + :paramtype disable_probe: bool + """ super(DeploymentSettingsContainerProbeSettings, self).__init__(**kwargs) self.disable_probe = disable_probe @@ -1555,12 +1843,12 @@ def __init__( class DiagnosticParameters(msrest.serialization.Model): """Diagnostic parameters of diagnostic operations. - :param app_instance: App instance name. - :type app_instance: str - :param file_path: Your target file path in your own BYOS. - :type file_path: str - :param duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :type duration: str + :ivar app_instance: App instance name. + :vartype app_instance: str + :ivar file_path: Your target file path in your own BYOS. + :vartype file_path: str + :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :vartype duration: str """ _attribute_map = { @@ -1577,6 +1865,14 @@ def __init__( duration: Optional[str] = None, **kwargs ): + """ + :keyword app_instance: App instance name. + :paramtype app_instance: str + :keyword file_path: Your target file path in your own BYOS. + :paramtype file_path: str + :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :paramtype duration: str + """ super(DiagnosticParameters, self).__init__(**kwargs) self.app_instance = app_instance self.file_path = file_path @@ -1586,10 +1882,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -1604,6 +1900,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1614,28 +1916,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -1673,6 +1975,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1690,10 +2016,10 @@ def __init__( class ImageRegistryCredential(msrest.serialization.Model): """Credential of the image registry. - :param username: The username of the image registry credential. - :type username: str - :param password: The password of the image registry credential. - :type password: str + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str """ _attribute_map = { @@ -1708,6 +2034,12 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = username self.password = password @@ -1720,8 +2052,8 @@ class KeyVaultCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the certificate source.Constant filled by server. - :type type: str + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -1736,15 +2068,15 @@ class KeyVaultCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str - :param exclude_private_key: Optional. If set to true, it will not import private key from key + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str + :ivar exclude_private_key: Optional. If set to true, it will not import private key from key vault. - :type exclude_private_key: bool + :vartype exclude_private_key: bool """ _validation = { @@ -1784,6 +2116,17 @@ def __init__( exclude_private_key: Optional[bool] = False, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + :keyword exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :paramtype exclude_private_key: bool + """ super(KeyVaultCertificateProperties, self).__init__(**kwargs) self.type = 'KeyVaultCertificate' # type: str self.vault_uri = vault_uri @@ -1797,11 +2140,11 @@ class LoadedCertificate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: Required. Resource Id of loaded certificate. - :type resource_id: str - :param load_trust_store: Indicate whether the certificate will be loaded into default trust + :ivar resource_id: Required. Resource Id of loaded certificate. + :vartype resource_id: str + :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. - :type load_trust_store: bool + :vartype load_trust_store: bool """ _validation = { @@ -1820,6 +2163,13 @@ def __init__( load_trust_store: Optional[bool] = False, **kwargs ): + """ + :keyword resource_id: Required. Resource Id of loaded certificate. + :paramtype resource_id: str + :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :paramtype load_trust_store: bool + """ super(LoadedCertificate, self).__init__(**kwargs) self.resource_id = resource_id self.load_trust_store = load_trust_store @@ -1830,8 +2180,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -1848,6 +2198,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1855,12 +2209,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1877,6 +2231,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1886,13 +2248,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -1909,6 +2271,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1918,13 +2289,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1941,6 +2312,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1950,31 +2330,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: Unit that makes sense for the metric. - :type unit: str - :param category: Name of the metric category that the metric belongs to. A metric can only + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types. - :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric. - :type dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] - :param source_mdm_namespace: Name of the MDM namespace. Optional. - :type source_mdm_namespace: str + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -2007,6 +2387,33 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2030,20 +2437,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingState - :param error: Error when apply Monitoring Setting changes. - :type error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated + since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate + if monitoringSettings enabled or not. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application insight agent. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions """ @@ -2071,6 +2478,23 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -2091,8 +2515,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the Monitoring Setting resource. - :type properties: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties """ @@ -2115,6 +2539,11 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -2122,12 +2551,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -2144,6 +2573,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2155,10 +2592,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -2178,6 +2615,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -2188,20 +2631,19 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfileOutboundIPs @@ -2235,6 +2677,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -2266,6 +2724,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -2273,22 +2733,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: Display of the operation. - :type display: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :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.appplatform.v2021_09_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -2303,10 +2773,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :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.appplatform.v2021_09_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -2314,14 +2797,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :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 = { @@ -2340,6 +2823,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2350,8 +2843,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification """ @@ -2365,6 +2858,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2374,12 +2872,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -2400,6 +2898,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -2411,9 +2915,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: "Primary", + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType + :vartype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType """ _validation = { @@ -2430,6 +2934,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2472,6 +2981,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2483,12 +2994,12 @@ def __init__( class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :type cpu: str - :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :type memory: str + :vartype cpu: str + :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, + 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :vartype memory: str """ _attribute_map = { @@ -2503,6 +3014,14 @@ def __init__( memory: Optional[str] = None, **kwargs ): + """ + :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 + for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :paramtype cpu: str + :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :paramtype memory: str + """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -2511,23 +3030,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :param tier: Gets the tier of SKU. - :type tier: str - :param capacity: Gets the capacity of SKU. - :type capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity - :param locations: Gets the set of locations that the SKU is available. - :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in those locations where + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype location_info: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] """ @@ -2553,6 +3072,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2566,10 +3105,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -2584,6 +3123,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2592,11 +3137,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2611,6 +3156,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2619,12 +3171,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU. - :type location: str - :param zones: Gets list of availability zones where the SKU is supported. - :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in specific zones. - :type zone_details: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] """ @@ -2642,6 +3194,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2651,10 +3212,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted. - :type locations: list[str] - :param zones: Gets list of availability zones where the SKU is restricted. - :type zones: list[str] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -2669,6 +3230,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2677,21 +3244,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to + :ivar values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2711,6 +3278,24 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2721,12 +3306,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :param name: Gets the set of zones that the SKU is available in with the + :ivar name: Gets the set of zones that the SKU is available in with the specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] """ @@ -2742,6 +3327,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2750,10 +3344,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -2768,6 +3362,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2784,11 +3384,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -2812,6 +3412,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2828,15 +3435,16 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - :param properties: Properties of the Service resource. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource. - :type sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku """ _validation = { @@ -2864,6 +3472,18 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2872,11 +3492,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2891,6 +3511,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2899,11 +3526,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] """ @@ -2919,6 +3546,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2927,12 +3562,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -2949,6 +3584,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2960,15 +3603,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :type maximum: int - :param default: Gets or sets the default. - :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType + :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType """ _validation = { @@ -2991,6 +3634,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -3006,8 +3660,9 @@ class StorageProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_type: Required. The type of the storage.Constant filled by server. - :type storage_type: str + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageType """ _validation = { @@ -3026,6 +3681,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageProperties, self).__init__(**kwargs) self.storage_type = None # type: Optional[str] @@ -3035,12 +3692,13 @@ class StorageAccount(StorageProperties): All required parameters must be populated in order to send to Azure. - :param storage_type: Required. The type of the storage.Constant filled by server. - :type storage_type: str - :param account_name: Required. The account name of the Azure Storage Account. - :type account_name: str - :param account_key: Required. The account key of the Azure Storage Account. - :type account_key: str + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageType + :ivar account_name: Required. The account name of the Azure Storage Account. + :vartype account_name: str + :ivar account_key: Required. The account key of the Azure Storage Account. + :vartype account_key: str """ _validation = { @@ -3062,6 +3720,12 @@ def __init__( account_key: str, **kwargs ): + """ + :keyword account_name: Required. The account name of the Azure Storage Account. + :paramtype account_name: str + :keyword account_key: Required. The account key of the Azure Storage Account. + :paramtype account_key: str + """ super(StorageAccount, self).__init__(**kwargs) self.storage_type = 'StorageAccount' # type: str self.account_name = account_name @@ -3079,8 +3743,8 @@ class StorageResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :param properties: Properties of the storage resource payload. - :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SystemData """ @@ -3106,6 +3770,10 @@ def __init__( properties: Optional["StorageProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties + """ super(StorageResource, self).__init__(**kwargs) self.properties = properties self.system_data = None @@ -3114,10 +3782,10 @@ def __init__( class StorageResourceCollection(msrest.serialization.Model): """Collection compose of storage resources list and a possible link for next page. - :param value: The storage resources list. - :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :param next_link: The link to next page of storage list. - :type next_link: str + :ivar value: The storage resources list. + :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str """ _attribute_map = { @@ -3132,6 +3800,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The storage resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ super(StorageResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3140,15 +3814,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -3165,6 +3839,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -3174,21 +3860,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3211,6 +3898,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3223,10 +3928,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB. - :type size_in_gb: int - :param mount_path: Mount path of the temporary disk. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -3245,6 +3950,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -3253,16 +3964,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -3283,6 +3994,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -3294,19 +4017,19 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source", "Container". - :type type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param version: Version of the source. - :type version: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar version: Version of the source. + :vartype version: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :type artifact_selector: str - :param custom_container: Custom container payload. - :type custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer + :vartype artifact_selector: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer """ _attribute_map = { @@ -3327,6 +4050,21 @@ def __init__( custom_container: Optional["CustomContainer"] = None, **kwargs ): + """ + :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + "Source", "Container". + :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword version: Version of the source. + :paramtype version: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py index 9252b1716cd..3a98683cb52 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,319 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +342,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - sync_status=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -65,7 +360,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,31 +372,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,50 +405,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -177,17 +465,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -201,14 +491,20 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -222,28 +518,22 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -253,46 +543,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,16 +588,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,14 +610,17 @@ def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -343,25 +633,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -371,52 +654,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -433,17 +711,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -457,14 +737,20 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -478,28 +764,22 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -509,17 +789,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.AppResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -528,45 +808,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -575,7 +858,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,19 +871,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace def get_resource_upload_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -616,29 +904,26 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -651,17 +936,19 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace def validate_domain( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -672,7 +959,8 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult @@ -683,34 +971,30 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -723,4 +1007,6 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py index 2203d1097fe..8c7a874dc79 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.BindingResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py index 909a09e8360..8c74b0b7123 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,185 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +208,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +235,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +267,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,17 +327,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,17 +350,24 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -217,28 +381,22 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,46 +406,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -297,16 +451,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,14 +473,17 @@ def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,25 +496,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,17 +517,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateResourceCollection"]: """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -385,45 +536,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -432,7 +586,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +599,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py index da944554e83..fa97da75ec5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,194 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +217,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +241,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +272,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +327,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +347,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -203,27 +377,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +402,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +457,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +477,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -334,27 +507,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,50 +532,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _validate_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -424,16 +587,18 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace def begin_validate( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -442,17 +607,24 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,27 +637,22 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -495,6 +662,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py index 7c95c48d105..f43ae67ea77 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainResourceCollection"]: """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py index 0075a59821e..22380901934 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,27 +6,591 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class DeploymentsOperations(object): +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_generate_heap_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_generate_thread_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_jfr_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class DeploymentsOperations(object): # pylint: disable=too-many-public-methods """DeploymentsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,15 +612,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +642,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +675,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +737,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -202,17 +763,24 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -227,29 +795,22 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +820,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +867,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +892,17 @@ def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +916,18 @@ def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +937,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +996,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -472,17 +1022,24 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -497,29 +1054,22 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,19 +1079,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,51 +1101,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,7 +1158,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,19 +1171,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, - resource_group_name, # type: str - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -633,50 +1192,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -685,7 +1247,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -694,49 +1260,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -746,17 +1309,18 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - def begin_start( + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,14 +1334,17 @@ def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,26 +1358,18 @@ def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -820,48 +1379,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _stop_initial( + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + def _stop_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -871,17 +1426,18 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - def begin_stop( + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,14 +1451,17 @@ def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -916,26 +1475,18 @@ def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -945,48 +1496,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -996,17 +1543,18 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - def begin_restart( + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,14 +1568,17 @@ def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1041,26 +1592,18 @@ def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,19 +1613,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + @distributed_trace def get_log_file_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1104,30 +1647,27 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1142,52 +1682,49 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - def _generate_heap_dump_initial( + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_heap_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1197,18 +1734,19 @@ def _generate_heap_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + - def begin_generate_heap_dump( + @distributed_trace + def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: """Generate Heap Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1221,17 +1759,22 @@ def begin_generate_heap_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1246,26 +1789,19 @@ def begin_generate_heap_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1275,54 +1811,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - def _generate_thread_dump_initial( + def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_thread_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1332,18 +1863,19 @@ def _generate_thread_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - def begin_generate_thread_dump( + + @distributed_trace + def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: """Generate Thread Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1356,17 +1888,22 @@ def begin_generate_thread_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1381,26 +1918,19 @@ def begin_generate_thread_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1410,54 +1940,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _start_jfr_initial( + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + def _start_jfr_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._start_jfr_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1467,18 +1992,19 @@ def _start_jfr_initial( if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore - def begin_start_jfr( + + @distributed_trace + def begin_start_jfr( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: """Start JFR. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1491,17 +2017,22 @@ def begin_start_jfr( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1516,26 +2047,19 @@ def begin_start_jfr( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1545,6 +2069,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py index 4b2214f6802..268cadda312 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,150 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +173,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +197,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +228,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +283,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +303,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -203,27 +333,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +358,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +413,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +433,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -334,27 +463,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,6 +488,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py index 9f101fb7be3..ca281fa37d2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,47 +73,49 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +137,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py index a3f7d1e885c..77be28c973b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,49 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,22 +89,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py index 4cbd1bb4a23..a3277b6014e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,519 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +542,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -71,28 +566,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,48 +597,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,16 +655,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -187,14 +678,20 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -207,27 +704,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -237,44 +729,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -284,15 +772,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,14 +791,17 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -321,24 +813,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,50 +834,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -408,16 +889,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -429,14 +912,20 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -449,27 +938,22 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -479,17 +963,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace def list_test_keys( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -507,28 +991,25 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,16 +1022,18 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace def regenerate_test_key( self, - resource_group_name, # type: str - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -559,7 +1042,8 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys @@ -570,33 +1054,29 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -609,15 +1089,17 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -635,28 +1117,25 @@ def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -666,15 +1145,16 @@ def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace def enable_test_endpoint( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -692,28 +1172,25 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,42 +1203,40 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - def _stop_initial( + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + def _stop_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -771,15 +1246,16 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - def begin_stop( + + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -789,14 +1265,17 @@ def begin_stop( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -808,24 +1287,18 @@ def begin_stop( raw_result = self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -835,44 +1308,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -882,15 +1351,16 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + - def begin_start( + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -900,14 +1370,17 @@ def begin_start( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -919,24 +1392,18 @@ def begin_start( raw_result = self._start_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -946,23 +1413,24 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + @distributed_trace def check_name_availability( self, - location, # type: str - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability @@ -973,32 +1441,28 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1011,53 +1475,55 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1066,7 +1532,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1075,17 +1545,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1093,43 +1564,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1138,7 +1610,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1147,7 +1623,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py index 03bebe5f0bf..171bbd6fa20 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,56 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class SkusOperations(object): """SkusOperations operations. @@ -45,51 +79,52 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,7 +133,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +146,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py index 6752237e796..d3fc54c14be 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,185 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class StoragesOperations(object): """StoragesOperations operations. @@ -47,14 +208,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageResource" + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> "_models.StorageResource": """Get the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +235,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +267,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - storage_resource, # type: "_models.StorageResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageResource" + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> "_models.StorageResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_resource, 'StorageResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,17 +327,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - storage_resource, # type: "_models.StorageResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageResource"] + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> LROPoller["_models.StorageResource"]: """Create or update storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -196,14 +353,20 @@ def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -217,28 +380,22 @@ def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,46 +405,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -297,16 +450,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,14 +472,17 @@ def begin_delete( :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,25 +495,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,17 +516,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageResourceCollection"]: """List all the storages of one Azure Spring Cloud instance. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -385,45 +535,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageResourceCollection', pipeline_response) + deserialized = self._deserialize("StorageResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -432,7 +585,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +598,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py index d2ddf950056..41ec6d71ff7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py index 075f127a8de..4633ae192d4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py @@ -6,66 +6,51 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import ConfigurationServicesOperations -from .operations import ServiceRegistriesOperations -from .operations import BuildServiceOperations -from .operations import BuildpackBindingOperations -from .operations import BuildServiceBuilderOperations -from .operations import BuildServiceAgentPoolOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import StoragesOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations -from .operations import GatewaysOperations -from .operations import GatewayRouteConfigsOperations -from .operations import GatewayCustomDomainsOperations -from .operations import ApiPortalsOperations -from .operations import ApiPortalCustomDomainsOperations from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2022_01_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigServersOperations :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigurationServicesOperations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigurationServicesOperations :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: azure.mgmt.appplatform.v2022_01_01_preview.operations.ServiceRegistriesOperations + :vartype service_registries: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ServiceRegistriesOperations :ivar build_service: BuildServiceOperations operations - :vartype build_service: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceOperations + :vartype build_service: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceOperations :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildpackBindingOperations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildpackBindingOperations :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceBuilderOperations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceBuilderOperations :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceAgentPoolOperations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceAgentPoolOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2022_01_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_01_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2022_01_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -73,117 +58,113 @@ class AppPlatformManagementClient(object): :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2022_01_01_preview.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_01_01_preview.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2022_01_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_01_01_preview.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2022_01_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2022_01_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2022_01_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_01_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2022_01_01_preview.operations.SkusOperations :ivar gateways: GatewaysOperations operations :vartype gateways: azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewaysOperations :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayRouteConfigsOperations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayRouteConfigsOperations :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayCustomDomainsOperations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayCustomDomainsOperations :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalsOperations + :vartype api_portals: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalsOperations :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalCustomDomainsOperations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalCustomDomainsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py index 307ac0800d9..62fe7927765 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py index 39f10548873..44ce4a5043f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py index 27b48307eb5..1a8e1445d17 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py @@ -6,64 +6,51 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ServicesOperations -from .operations import ConfigServersOperations -from .operations import ConfigurationServicesOperations -from .operations import ServiceRegistriesOperations -from .operations import BuildServiceOperations -from .operations import BuildpackBindingOperations -from .operations import BuildServiceBuilderOperations -from .operations import BuildServiceAgentPoolOperations -from .operations import MonitoringSettingsOperations -from .operations import AppsOperations -from .operations import BindingsOperations -from .operations import StoragesOperations -from .operations import CertificatesOperations -from .operations import CustomDomainsOperations -from .operations import DeploymentsOperations -from .operations import Operations -from .operations import RuntimeVersionsOperations -from .operations import SkusOperations -from .operations import GatewaysOperations -from .operations import GatewayRouteConfigsOperations -from .operations import GatewayCustomDomainsOperations -from .operations import ApiPortalsOperations -from .operations import ApiPortalCustomDomainsOperations from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient(object): +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigServersOperations :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigurationServicesOperations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigurationServicesOperations :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ServiceRegistriesOperations + :vartype service_registries: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ServiceRegistriesOperations :ivar build_service: BuildServiceOperations operations - :vartype build_service: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceOperations + :vartype build_service: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceOperations :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildpackBindingOperations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildpackBindingOperations :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceBuilderOperations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceBuilderOperations :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceAgentPoolOperations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceAgentPoolOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -71,115 +58,113 @@ class AppPlatformManagementClient(object): :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CertificatesOperations + :vartype certificates: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.SkusOperations :ivar gateways: GatewaysOperations operations :vartype gateways: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewaysOperations :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayRouteConfigsOperations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayRouteConfigsOperations :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayCustomDomainsOperations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayCustomDomainsOperations :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalsOperations + :vartype api_portals: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalsOperations :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations( - self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations( - self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateways = GatewaysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_route_configs = GatewayRouteConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.gateway_custom_domains = GatewayCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_portals = ApiPortalsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py index 8f5510ed6e0..7b9398e3372 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py index ed4c82d6888..2147a0e1dea 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_portal_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,8 +169,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -193,17 +196,24 @@ async def begin_create_or_update( :type domain_name: str :param api_portal_custom_domain_resource: The API portal custom domain for the create or update operation. - :type api_portal_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( @@ -218,29 +228,22 @@ async def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -250,11 +253,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -267,30 +270,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -300,9 +300,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -323,14 +325,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -344,26 +349,18 @@ async def begin_delete( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -373,10 +370,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -394,46 +392,50 @@ def list( :param api_portal_name: The name of API portal. :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiPortalCustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -442,7 +444,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -451,7 +457,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py index 486f62751c0..86e7e4d35b4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._api_portals_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(api_portal_resource, 'ApiPortalResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,8 +163,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,14 +189,20 @@ async def begin_create_or_update( :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( @@ -207,28 +216,22 @@ async def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -254,29 +257,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -286,9 +286,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -306,14 +308,17 @@ async def begin_delete( :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -326,25 +331,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,10 +352,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -372,45 +371,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] + :return: An iterator like instance of either ApiPortalResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApiPortalResourceCollection', pipeline_response) + deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,7 +421,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -428,11 +434,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -451,7 +459,8 @@ async def validate_domain( :param api_portal_name: The name of API portal. :type api_portal_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -462,34 +471,30 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -502,4 +507,6 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py index 3f338481215..d1acb17b8fd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_set_active_deployments_request_initial, build_update_request_initial, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -60,7 +65,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -72,31 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,34 +127,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -171,8 +170,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,14 +196,20 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -215,28 +223,22 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -246,11 +248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -262,29 +264,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -294,9 +293,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -314,14 +315,17 @@ async def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,25 +338,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -362,9 +359,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore async def _update_initial( self, @@ -379,34 +376,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -423,8 +416,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -446,14 +442,20 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -467,28 +469,22 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -498,10 +494,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -516,45 +513,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,7 +563,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,11 +576,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -603,29 +609,26 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -638,7 +641,9 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + async def _set_active_deployments_initial( self, @@ -653,34 +658,30 @@ async def _set_active_deployments_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._set_active_deployments_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._set_active_deployments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -697,8 +698,11 @@ async def _set_active_deployments_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + + @distributed_trace_async async def begin_set_active_deployments( self, resource_group_name: str, @@ -717,17 +721,24 @@ async def begin_set_active_deployments( :param app_name: The name of the App resource. :type app_name: str :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -741,28 +752,22 @@ async def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -772,10 +777,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -794,7 +800,8 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -805,34 +812,30 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -845,4 +848,6 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py index 9fad4251796..028f51b987f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py index f60cf408b53..05fa4b953ae 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._build_service_agent_pool_operations import build_get_request, build_list_request, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -60,46 +65,50 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildServiceAgentPoolResourceCollection', pipeline_response) + deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,7 +117,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,11 +130,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -151,30 +166,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -187,7 +199,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + async def _update_put_initial( self, @@ -195,7 +209,7 @@ async def _update_put_initial( service_name: str, build_service_name: str, agent_pool_name: str, - pool_size: "_models.BuildServiceAgentPoolSizeProperties", + agent_pool_resource: "_models.BuildServiceAgentPoolResource", **kwargs: Any ) -> "_models.BuildServiceAgentPoolResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] @@ -203,35 +217,31 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pool_size, 'BuildServiceAgentPoolSizeProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -248,15 +258,18 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, service_name: str, build_service_name: str, agent_pool_name: str, - pool_size: "_models.BuildServiceAgentPoolSizeProperties", + agent_pool_resource: "_models.BuildServiceAgentPoolResource", **kwargs: Any ) -> AsyncLROPoller["_models.BuildServiceAgentPoolResource"]: """Create or update build service agent pool. @@ -270,18 +283,25 @@ async def begin_update_put( :type build_service_name: str :param agent_pool_name: The name of the build service agent pool resource. :type agent_pool_name: str - :param pool_size: Parameters for the update operation. - :type pool_size: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( @@ -295,30 +315,23 @@ async def begin_update_put( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - pool_size=pool_size, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -328,6 +341,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py index 465b350940c..e7c8a2a7c5f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._build_service_builder_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(builder_resource, 'BuilderResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,8 +169,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,14 +198,20 @@ async def begin_create_or_update( :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( @@ -217,29 +226,22 @@ async def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuilderResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -249,11 +251,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -266,30 +268,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -299,9 +298,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -322,14 +323,17 @@ async def begin_delete( :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -343,26 +347,18 @@ async def begin_delete( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,10 +368,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -393,46 +390,50 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] + :return: An iterator like instance of either BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuilderResourceCollection', pipeline_response) + deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -441,7 +442,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -450,7 +455,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py index 3b2f70331b8..8184e9aa40d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._build_service_operations import build_create_or_update_build_request, build_get_build_request, build_get_build_result_log_request, build_get_build_result_request, build_get_build_service_request, build_get_resource_upload_url_request, build_get_supported_buildpack_request, build_get_supported_stack_request, build_list_build_results_request, build_list_build_services_request, build_list_builds_request, build_list_supported_buildpacks_request, build_list_supported_stacks_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_build_services( self, resource_group_name: str, @@ -55,45 +60,48 @@ def list_build_services( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_build_services.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildServiceCollection', pipeline_response) + deserialized = self._deserialize("BuildServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,7 +110,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,11 +123,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + @distributed_trace_async async def get_build_service( self, resource_group_name: str, @@ -142,29 +156,26 @@ async def get_build_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_build_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,8 +188,11 @@ async def get_build_service( return cls(pipeline_response, deserialized, {}) return deserialized - get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + + + @distributed_trace def list_builds( self, resource_group_name: str, @@ -197,45 +211,48 @@ def list_builds( :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_builds.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildCollection', pipeline_response) + deserialized = self._deserialize("BuildCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -244,7 +261,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -253,11 +274,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + @distributed_trace_async async def get_build( self, resource_group_name: str, @@ -287,30 +310,27 @@ async def get_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.get_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -323,8 +343,11 @@ async def get_build( return cls(pipeline_response, deserialized, {}) return deserialized - get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace_async async def create_or_update_build( self, resource_group_name: str, @@ -357,35 +380,31 @@ async def create_or_update_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_build.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build, 'Build') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -402,8 +421,11 @@ async def create_or_update_build( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace def list_build_results( self, resource_group_name: str, @@ -424,47 +446,52 @@ def list_build_results( :param build_name: The name of the build resource. :type build_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_build_results.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildResultCollection', pipeline_response) + deserialized = self._deserialize("BuildResultCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -473,7 +500,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -482,11 +513,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + @distributed_trace_async async def get_build_result( self, resource_group_name: str, @@ -519,31 +552,28 @@ async def get_build_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -556,8 +586,11 @@ async def get_build_result( return cls(pipeline_response, deserialized, {}) return deserialized - get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + + + @distributed_trace_async async def get_build_result_log( self, resource_group_name: str, @@ -590,31 +623,28 @@ async def get_build_result_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_result_log.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -627,8 +657,11 @@ async def get_build_result_log( return cls(pipeline_response, deserialized, {}) return deserialized - get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + + + @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -655,29 +688,26 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -690,8 +720,11 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace_async async def list_supported_buildpacks( self, resource_group_name: str, @@ -718,29 +751,26 @@ async def list_supported_buildpacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_supported_buildpacks.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_buildpacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -753,8 +783,11 @@ async def list_supported_buildpacks( return cls(pipeline_response, deserialized, {}) return deserialized - list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + + + @distributed_trace_async async def get_supported_buildpack( self, resource_group_name: str, @@ -784,30 +817,27 @@ async def get_supported_buildpack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_supported_buildpack.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildpackName': self._serialize.url("buildpack_name", buildpack_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + api_version=api_version, + template_url=self.get_supported_buildpack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -820,8 +850,11 @@ async def get_supported_buildpack( return cls(pipeline_response, deserialized, {}) return deserialized - get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + + + @distributed_trace_async async def list_supported_stacks( self, resource_group_name: str, @@ -848,29 +881,26 @@ async def list_supported_stacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_supported_stacks.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_stacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -883,8 +913,11 @@ async def list_supported_stacks( return cls(pipeline_response, deserialized, {}) return deserialized - list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + + + @distributed_trace_async async def get_supported_stack( self, resource_group_name: str, @@ -914,30 +947,27 @@ async def get_supported_stack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_supported_stack.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'stackName': self._serialize.url("stack_name", stack_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + api_version=api_version, + template_url=self.get_supported_stack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -950,4 +980,6 @@ async def get_supported_stack( return cls(pipeline_response, deserialized, {}) return deserialized - get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore + + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py index 46c7730c901..36bce4599b0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._buildpack_binding_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -75,31 +80,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,7 +114,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + async def _create_or_update_initial( self, @@ -129,36 +133,32 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -175,8 +175,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,17 +204,24 @@ async def begin_create_or_update( :param buildpack_binding_name: The name of the Buildpack Binding Name. :type buildpack_binding_name: str :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :type buildpack_binding: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( @@ -227,30 +237,22 @@ async def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -260,11 +262,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -278,31 +280,28 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -312,9 +311,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -338,14 +339,17 @@ async def begin_delete( :type buildpack_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -360,27 +364,18 @@ async def begin_delete( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -390,10 +385,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -414,47 +410,52 @@ def list( :param builder_name: The name of the builder resource. :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BuildpackBindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -463,7 +464,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -472,7 +477,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py index 7d289ba0f53..bf472f84902 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,17 +189,24 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -210,28 +220,22 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +245,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -257,29 +261,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,9 +290,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -309,14 +312,17 @@ async def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -329,25 +335,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,10 +356,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -375,45 +375,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -422,7 +425,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +438,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py index 8401332e3fd..ab5eceaefae 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,9 +360,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _validate_initial( self, @@ -371,33 +376,29 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -414,8 +415,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -431,17 +435,24 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -454,27 +465,22 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -484,6 +490,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py index 0d447012151..6532d671e0f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._configuration_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,8 +163,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -184,17 +187,24 @@ async def begin_create_or_update( :param configuration_service_name: The name of Application Configuration Service. :type configuration_service_name: str :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( @@ -208,28 +218,22 @@ async def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -239,11 +243,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -255,29 +259,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -287,9 +288,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -307,14 +310,17 @@ async def begin_delete( :type configuration_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -327,25 +333,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,10 +354,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -373,45 +373,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ConfigurationServiceResourceCollection', pipeline_response) + deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -420,7 +423,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -429,10 +436,11 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore async def _validate_initial( self, @@ -447,34 +455,30 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(settings, 'ConfigurationServiceSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -491,8 +495,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + + + @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -514,14 +521,20 @@ async def begin_validate( :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( @@ -535,28 +548,22 @@ async def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -566,6 +573,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py index 9e9f5ad6ab2..adf270af6db 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,14 +201,20 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -220,29 +229,22 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +326,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +350,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore async def _update_initial( self, @@ -393,35 +389,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +430,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -464,14 +459,20 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -486,29 +487,22 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +512,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,46 +534,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -587,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,7 +599,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py index 0a1fa32f738..07637f590ba 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DeploymentsOperations: +class DeploymentsOperations: # pylint: disable=too-many-public-methods """DeploymentsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,8 +172,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,17 +198,24 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -220,29 +230,22 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,11 +255,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -269,30 +272,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,9 +302,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -325,14 +327,17 @@ async def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -346,26 +351,18 @@ async def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -375,9 +372,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore async def _update_initial( self, @@ -393,35 +390,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -438,8 +431,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -461,17 +457,24 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -486,29 +489,22 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -518,10 +514,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -539,51 +536,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -592,7 +593,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,11 +606,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -620,50 +627,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -672,7 +682,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -681,12 +695,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -699,30 +714,27 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -732,9 +744,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - async def begin_start( + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -755,14 +769,17 @@ async def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -776,26 +793,18 @@ async def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,11 +814,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _stop_initial( + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -822,30 +831,27 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -855,9 +861,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - async def begin_stop( + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -878,14 +886,17 @@ async def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -899,26 +910,18 @@ async def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -928,11 +931,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -945,30 +948,27 @@ async def _restart_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,9 +978,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + - async def begin_restart( + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1001,14 +1003,17 @@ async def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1022,26 +1027,18 @@ async def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1051,10 +1048,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1084,30 +1082,27 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1122,9 +1117,11 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - async def _generate_heap_dump_initial( + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1138,35 +1135,31 @@ async def _generate_heap_dump_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_heap_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1176,9 +1169,11 @@ async def _generate_heap_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - async def begin_generate_heap_dump( + + @distributed_trace_async + async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1199,17 +1194,22 @@ async def begin_generate_heap_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1224,26 +1224,19 @@ async def begin_generate_heap_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1253,11 +1246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _generate_thread_dump_initial( + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1271,35 +1264,31 @@ async def _generate_thread_dump_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_thread_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1309,9 +1298,11 @@ async def _generate_thread_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + - async def begin_generate_thread_dump( + @distributed_trace_async + async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1332,17 +1323,22 @@ async def begin_generate_thread_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1357,26 +1353,19 @@ async def begin_generate_thread_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1386,11 +1375,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - async def _start_jfr_initial( + async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1404,35 +1393,31 @@ async def _start_jfr_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._start_jfr_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1442,9 +1427,11 @@ async def _start_jfr_initial( if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore - async def begin_start_jfr( + + @distributed_trace_async + async def begin_start_jfr( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1465,17 +1452,22 @@ async def begin_start_jfr( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1490,26 +1482,19 @@ async def begin_start_jfr( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1519,6 +1504,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py index a16058f20a3..bda4b0a1ea0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gateway_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,8 +169,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -193,17 +196,24 @@ async def begin_create_or_update( :type domain_name: str :param gateway_custom_domain_resource: The gateway custom domain resource for the create or update operation. - :type gateway_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( @@ -218,29 +228,22 @@ async def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -250,11 +253,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -267,30 +270,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -300,9 +300,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -323,14 +325,17 @@ async def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -344,26 +349,18 @@ async def begin_delete( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -373,10 +370,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -394,46 +392,50 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayCustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -442,7 +444,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -451,7 +457,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py index 879835a5a33..e50ce43897d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gateway_route_configs_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -72,30 +77,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +110,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + async def _create_or_update_initial( self, @@ -124,35 +128,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,8 +169,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -194,17 +197,24 @@ async def begin_create_or_update( :type route_config_name: str :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or update operation. - :type gateway_route_config_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( @@ -219,29 +229,22 @@ async def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -251,11 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -268,30 +271,27 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,9 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -324,14 +326,17 @@ async def begin_delete( :type route_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -345,26 +350,18 @@ async def begin_delete( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -374,10 +371,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -395,46 +393,50 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayRouteConfigResourceCollection', pipeline_response) + deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -443,7 +445,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -452,7 +458,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py index c6a16f88f9c..6a07fd9f990 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._gateways_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gateway_resource, 'GatewayResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_resource, 'GatewayResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,8 +163,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,14 +189,20 @@ async def begin_create_or_update( :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( @@ -207,28 +216,22 @@ async def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GatewayResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -254,29 +257,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -286,9 +286,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -306,14 +308,17 @@ async def begin_delete( :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -326,25 +331,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,10 +352,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -372,45 +371,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] + :return: An iterator like instance of either GatewayResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayResourceCollection', pipeline_response) + deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,7 +421,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -428,11 +434,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -451,7 +459,8 @@ async def validate_domain( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -462,34 +471,30 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -502,4 +507,6 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py index 4b9dc1db8fb..3598039f413 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,28 +69,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,7 +100,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + async def _update_put_initial( self, @@ -113,33 +116,29 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,8 +155,11 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -173,17 +175,24 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -196,27 +205,22 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -226,9 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore async def _update_patch_initial( self, @@ -242,33 +246,29 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,8 +285,11 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -302,17 +305,24 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -325,27 +335,22 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,6 +360,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py index abbd206c94e..c91fe0675ca 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,38 +53,40 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,7 +95,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +108,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py index 65d60cb0677..d2534b0635f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -56,22 +60,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,4 +88,6 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py index f160fa212ba..7345418874b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._service_registries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + async def _create_or_update_initial( self, @@ -118,29 +122,26 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -157,8 +158,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -177,14 +181,19 @@ async def begin_create_or_update( :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( @@ -197,28 +206,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,11 +230,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -244,29 +246,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -276,9 +275,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -296,14 +297,17 @@ async def begin_delete( :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -316,25 +320,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -344,10 +341,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -362,45 +360,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceRegistryResourceCollection', pipeline_response) + deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -409,7 +410,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -418,7 +423,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py index bde4f4bf318..ad5a79c8524 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,28 +71,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +102,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -114,33 +118,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,8 +160,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -180,14 +183,20 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -200,27 +209,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,11 +234,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -245,28 +249,25 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -276,9 +277,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -293,14 +296,17 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -312,24 +318,18 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore async def _update_initial( self, @@ -355,33 +355,29 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -398,8 +394,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -418,14 +417,20 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -438,27 +443,22 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,10 +468,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -495,28 +496,25 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -529,8 +527,11 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -546,7 +547,8 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys @@ -557,33 +559,29 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -596,9 +594,12 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - async def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -621,28 +622,25 @@ async def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -652,8 +650,10 @@ async def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,28 +677,25 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,9 +708,11 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - async def _stop_initial( + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -724,28 +723,25 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -755,9 +751,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + - async def begin_stop( + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -772,14 +770,17 @@ async def begin_stop( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,24 +792,18 @@ async def begin_stop( raw_result = await self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -818,11 +813,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _start_initial( + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -833,28 +828,25 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -864,9 +856,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + - async def begin_start( + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -881,14 +875,17 @@ async def begin_start( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -900,24 +897,18 @@ async def begin_start( raw_result = await self._start_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -927,10 +918,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + + @distributed_trace_async async def check_name_availability( self, location: str, @@ -942,7 +934,8 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability @@ -953,32 +946,28 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -991,8 +980,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -1001,42 +993,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1045,7 +1037,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1054,11 +1050,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -1071,43 +1069,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1116,7 +1115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1125,7 +1128,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py index b577ccb270a..2d4863be299 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,43 +52,44 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,7 +98,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,7 +111,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py index 37643ae075c..e0e602f6d27 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._storages_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,29 +74,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,7 +106,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,34 +123,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_resource, 'StorageResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,14 +192,20 @@ async def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -210,28 +219,22 @@ async def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +244,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -257,29 +260,26 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,9 +289,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -309,14 +311,17 @@ async def begin_delete( :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -329,25 +334,18 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -357,10 +355,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -375,45 +374,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('StorageResourceCollection', pipeline_response) + deserialized = self._deserialize("StorageResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -422,7 +424,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -431,7 +437,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py index 89a09924b4b..70cda27f9ac 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py @@ -6,342 +6,176 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ActiveDeploymentCollection - from ._models_py3 import ApiPortalCustomDomainProperties - from ._models_py3 import ApiPortalCustomDomainResource - from ._models_py3 import ApiPortalCustomDomainResourceCollection - from ._models_py3 import ApiPortalInstance - from ._models_py3 import ApiPortalProperties - from ._models_py3 import ApiPortalResource - from ._models_py3 import ApiPortalResourceCollection - from ._models_py3 import ApiPortalResourceRequests - from ._models_py3 import AppResource - from ._models_py3 import AppResourceCollection - from ._models_py3 import AppResourceProperties - from ._models_py3 import ApplicationInsightsAgentVersions - from ._models_py3 import AvailableOperations - from ._models_py3 import AvailableRuntimeVersions - from ._models_py3 import AzureFileVolume - from ._models_py3 import BindingResource - from ._models_py3 import BindingResourceCollection - from ._models_py3 import BindingResourceProperties - from ._models_py3 import Build - from ._models_py3 import BuildCollection - from ._models_py3 import BuildProperties - from ._models_py3 import BuildResult - from ._models_py3 import BuildResultCollection - from ._models_py3 import BuildResultLog - from ._models_py3 import BuildResultProperties - from ._models_py3 import BuildResultUserSourceInfo - from ._models_py3 import BuildService - from ._models_py3 import BuildServiceAgentPoolProperties - from ._models_py3 import BuildServiceAgentPoolResource - from ._models_py3 import BuildServiceAgentPoolResourceCollection - from ._models_py3 import BuildServiceAgentPoolSizeProperties - from ._models_py3 import BuildServiceCollection - from ._models_py3 import BuildServiceProperties - from ._models_py3 import BuildServicePropertiesResourceRequests - from ._models_py3 import BuildStageProperties - from ._models_py3 import BuilderProperties - from ._models_py3 import BuilderResource - from ._models_py3 import BuilderResourceCollection - from ._models_py3 import BuildpackBindingLaunchProperties - from ._models_py3 import BuildpackBindingProperties - from ._models_py3 import BuildpackBindingResource - from ._models_py3 import BuildpackBindingResourceCollection - from ._models_py3 import BuildpackProperties - from ._models_py3 import BuildpacksGroupProperties - from ._models_py3 import CertificateProperties - from ._models_py3 import CertificateResource - from ._models_py3 import CertificateResourceCollection - from ._models_py3 import CloudErrorBody - from ._models_py3 import ClusterResourceProperties - from ._models_py3 import ConfigServerGitProperty - from ._models_py3 import ConfigServerProperties - from ._models_py3 import ConfigServerResource - from ._models_py3 import ConfigServerSettings - from ._models_py3 import ConfigServerSettingsErrorRecord - from ._models_py3 import ConfigServerSettingsValidateResult - from ._models_py3 import ConfigurationServiceGitProperty - from ._models_py3 import ConfigurationServiceGitPropertyValidateResult - from ._models_py3 import ConfigurationServiceGitRepository - from ._models_py3 import ConfigurationServiceInstance - from ._models_py3 import ConfigurationServiceProperties - from ._models_py3 import ConfigurationServiceResource - from ._models_py3 import ConfigurationServiceResourceCollection - from ._models_py3 import ConfigurationServiceResourceRequests - from ._models_py3 import ConfigurationServiceSettings - from ._models_py3 import ConfigurationServiceSettingsValidateResult - from ._models_py3 import ContainerProbeSettings - from ._models_py3 import ContentCertificateProperties - from ._models_py3 import CustomContainer - from ._models_py3 import CustomContainerUserSourceInfo - from ._models_py3 import CustomDomainProperties - from ._models_py3 import CustomDomainResource - from ._models_py3 import CustomDomainResourceCollection - from ._models_py3 import CustomDomainValidatePayload - from ._models_py3 import CustomDomainValidateResult - from ._models_py3 import CustomPersistentDiskProperties - from ._models_py3 import CustomPersistentDiskResource - from ._models_py3 import DeploymentInstance - from ._models_py3 import DeploymentResource - from ._models_py3 import DeploymentResourceCollection - from ._models_py3 import DeploymentResourceProperties - from ._models_py3 import DeploymentSettings - from ._models_py3 import DiagnosticParameters - from ._models_py3 import Error - from ._models_py3 import GatewayApiMetadataProperties - from ._models_py3 import GatewayApiRoute - from ._models_py3 import GatewayCorsProperties - from ._models_py3 import GatewayCustomDomainProperties - from ._models_py3 import GatewayCustomDomainResource - from ._models_py3 import GatewayCustomDomainResourceCollection - from ._models_py3 import GatewayInstance - from ._models_py3 import GatewayOperatorProperties - from ._models_py3 import GatewayOperatorResourceRequests - from ._models_py3 import GatewayProperties - from ._models_py3 import GatewayResource - from ._models_py3 import GatewayResourceCollection - from ._models_py3 import GatewayResourceRequests - from ._models_py3 import GatewayRouteConfigProperties - from ._models_py3 import GatewayRouteConfigResource - from ._models_py3 import GatewayRouteConfigResourceCollection - from ._models_py3 import GitPatternRepository - from ._models_py3 import ImageRegistryCredential - from ._models_py3 import JarUploadedUserSourceInfo - from ._models_py3 import KeyVaultCertificateProperties - from ._models_py3 import LoadedCertificate - from ._models_py3 import LogFileUrlResponse - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedIdentityProperties - from ._models_py3 import MetricDimension - from ._models_py3 import MetricSpecification - from ._models_py3 import MonitoringSettingProperties - from ._models_py3 import MonitoringSettingResource - from ._models_py3 import NameAvailability - from ._models_py3 import NameAvailabilityParameters - from ._models_py3 import NetCoreZipUploadedUserSourceInfo - from ._models_py3 import NetworkProfile - from ._models_py3 import NetworkProfileOutboundIPs - from ._models_py3 import OperationDetail - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationProperties - from ._models_py3 import PersistentDisk - from ._models_py3 import ProxyResource - from ._models_py3 import RegenerateTestKeyRequestPayload - from ._models_py3 import RequiredTraffic - from ._models_py3 import Resource - from ._models_py3 import ResourceRequests - from ._models_py3 import ResourceSku - from ._models_py3 import ResourceSkuCapabilities - from ._models_py3 import ResourceSkuCollection - from ._models_py3 import ResourceSkuLocationInfo - from ._models_py3 import ResourceSkuRestrictionInfo - from ._models_py3 import ResourceSkuRestrictions - from ._models_py3 import ResourceSkuZoneDetails - from ._models_py3 import ResourceUploadDefinition - from ._models_py3 import ServiceRegistryInstance - from ._models_py3 import ServiceRegistryProperties - from ._models_py3 import ServiceRegistryResource - from ._models_py3 import ServiceRegistryResourceCollection - from ._models_py3 import ServiceRegistryResourceRequests - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SkuCapacity - from ._models_py3 import SourceUploadedUserSourceInfo - from ._models_py3 import SsoProperties - from ._models_py3 import StackProperties - from ._models_py3 import StorageAccount - from ._models_py3 import StorageProperties - from ._models_py3 import StorageResource - from ._models_py3 import StorageResourceCollection - from ._models_py3 import SupportedBuildpackResource - from ._models_py3 import SupportedBuildpackResourceProperties - from ._models_py3 import SupportedBuildpacksCollection - from ._models_py3 import SupportedRuntimeVersion - from ._models_py3 import SupportedStackResource - from ._models_py3 import SupportedStackResourceProperties - from ._models_py3 import SupportedStacksCollection - from ._models_py3 import SystemData - from ._models_py3 import TemporaryDisk - from ._models_py3 import TestKeys - from ._models_py3 import TrackedResource - from ._models_py3 import TriggeredBuildResult - from ._models_py3 import UploadedUserSourceInfo - from ._models_py3 import UserSourceInfo - from ._models_py3 import ValidationMessages -except (SyntaxError, ImportError): - from ._models import ActiveDeploymentCollection # type: ignore - from ._models import ApiPortalCustomDomainProperties # type: ignore - from ._models import ApiPortalCustomDomainResource # type: ignore - from ._models import ApiPortalCustomDomainResourceCollection # type: ignore - from ._models import ApiPortalInstance # type: ignore - from ._models import ApiPortalProperties # type: ignore - from ._models import ApiPortalResource # type: ignore - from ._models import ApiPortalResourceCollection # type: ignore - from ._models import ApiPortalResourceRequests # type: ignore - from ._models import AppResource # type: ignore - from ._models import AppResourceCollection # type: ignore - from ._models import AppResourceProperties # type: ignore - from ._models import ApplicationInsightsAgentVersions # type: ignore - from ._models import AvailableOperations # type: ignore - from ._models import AvailableRuntimeVersions # type: ignore - from ._models import AzureFileVolume # type: ignore - from ._models import BindingResource # type: ignore - from ._models import BindingResourceCollection # type: ignore - from ._models import BindingResourceProperties # type: ignore - from ._models import Build # type: ignore - from ._models import BuildCollection # type: ignore - from ._models import BuildProperties # type: ignore - from ._models import BuildResult # type: ignore - from ._models import BuildResultCollection # type: ignore - from ._models import BuildResultLog # type: ignore - from ._models import BuildResultProperties # type: ignore - from ._models import BuildResultUserSourceInfo # type: ignore - from ._models import BuildService # type: ignore - from ._models import BuildServiceAgentPoolProperties # type: ignore - from ._models import BuildServiceAgentPoolResource # type: ignore - from ._models import BuildServiceAgentPoolResourceCollection # type: ignore - from ._models import BuildServiceAgentPoolSizeProperties # type: ignore - from ._models import BuildServiceCollection # type: ignore - from ._models import BuildServiceProperties # type: ignore - from ._models import BuildServicePropertiesResourceRequests # type: ignore - from ._models import BuildStageProperties # type: ignore - from ._models import BuilderProperties # type: ignore - from ._models import BuilderResource # type: ignore - from ._models import BuilderResourceCollection # type: ignore - from ._models import BuildpackBindingLaunchProperties # type: ignore - from ._models import BuildpackBindingProperties # type: ignore - from ._models import BuildpackBindingResource # type: ignore - from ._models import BuildpackBindingResourceCollection # type: ignore - from ._models import BuildpackProperties # type: ignore - from ._models import BuildpacksGroupProperties # type: ignore - from ._models import CertificateProperties # type: ignore - from ._models import CertificateResource # type: ignore - from ._models import CertificateResourceCollection # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import ClusterResourceProperties # type: ignore - from ._models import ConfigServerGitProperty # type: ignore - from ._models import ConfigServerProperties # type: ignore - from ._models import ConfigServerResource # type: ignore - from ._models import ConfigServerSettings # type: ignore - from ._models import ConfigServerSettingsErrorRecord # type: ignore - from ._models import ConfigServerSettingsValidateResult # type: ignore - from ._models import ConfigurationServiceGitProperty # type: ignore - from ._models import ConfigurationServiceGitPropertyValidateResult # type: ignore - from ._models import ConfigurationServiceGitRepository # type: ignore - from ._models import ConfigurationServiceInstance # type: ignore - from ._models import ConfigurationServiceProperties # type: ignore - from ._models import ConfigurationServiceResource # type: ignore - from ._models import ConfigurationServiceResourceCollection # type: ignore - from ._models import ConfigurationServiceResourceRequests # type: ignore - from ._models import ConfigurationServiceSettings # type: ignore - from ._models import ConfigurationServiceSettingsValidateResult # type: ignore - from ._models import ContainerProbeSettings # type: ignore - from ._models import ContentCertificateProperties # type: ignore - from ._models import CustomContainer # type: ignore - from ._models import CustomContainerUserSourceInfo # type: ignore - from ._models import CustomDomainProperties # type: ignore - from ._models import CustomDomainResource # type: ignore - from ._models import CustomDomainResourceCollection # type: ignore - from ._models import CustomDomainValidatePayload # type: ignore - from ._models import CustomDomainValidateResult # type: ignore - from ._models import CustomPersistentDiskProperties # type: ignore - from ._models import CustomPersistentDiskResource # type: ignore - from ._models import DeploymentInstance # type: ignore - from ._models import DeploymentResource # type: ignore - from ._models import DeploymentResourceCollection # type: ignore - from ._models import DeploymentResourceProperties # type: ignore - from ._models import DeploymentSettings # type: ignore - from ._models import DiagnosticParameters # type: ignore - from ._models import Error # type: ignore - from ._models import GatewayApiMetadataProperties # type: ignore - from ._models import GatewayApiRoute # type: ignore - from ._models import GatewayCorsProperties # type: ignore - from ._models import GatewayCustomDomainProperties # type: ignore - from ._models import GatewayCustomDomainResource # type: ignore - from ._models import GatewayCustomDomainResourceCollection # type: ignore - from ._models import GatewayInstance # type: ignore - from ._models import GatewayOperatorProperties # type: ignore - from ._models import GatewayOperatorResourceRequests # type: ignore - from ._models import GatewayProperties # type: ignore - from ._models import GatewayResource # type: ignore - from ._models import GatewayResourceCollection # type: ignore - from ._models import GatewayResourceRequests # type: ignore - from ._models import GatewayRouteConfigProperties # type: ignore - from ._models import GatewayRouteConfigResource # type: ignore - from ._models import GatewayRouteConfigResourceCollection # type: ignore - from ._models import GitPatternRepository # type: ignore - from ._models import ImageRegistryCredential # type: ignore - from ._models import JarUploadedUserSourceInfo # type: ignore - from ._models import KeyVaultCertificateProperties # type: ignore - from ._models import LoadedCertificate # type: ignore - from ._models import LogFileUrlResponse # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedIdentityProperties # type: ignore - from ._models import MetricDimension # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonitoringSettingProperties # type: ignore - from ._models import MonitoringSettingResource # type: ignore - from ._models import NameAvailability # type: ignore - from ._models import NameAvailabilityParameters # type: ignore - from ._models import NetCoreZipUploadedUserSourceInfo # type: ignore - from ._models import NetworkProfile # type: ignore - from ._models import NetworkProfileOutboundIPs # type: ignore - from ._models import OperationDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import PersistentDisk # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RegenerateTestKeyRequestPayload # type: ignore - from ._models import RequiredTraffic # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceRequests # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import ResourceSkuCapabilities # type: ignore - from ._models import ResourceSkuCollection # type: ignore - from ._models import ResourceSkuLocationInfo # type: ignore - from ._models import ResourceSkuRestrictionInfo # type: ignore - from ._models import ResourceSkuRestrictions # type: ignore - from ._models import ResourceSkuZoneDetails # type: ignore - from ._models import ResourceUploadDefinition # type: ignore - from ._models import ServiceRegistryInstance # type: ignore - from ._models import ServiceRegistryProperties # type: ignore - from ._models import ServiceRegistryResource # type: ignore - from ._models import ServiceRegistryResourceCollection # type: ignore - from ._models import ServiceRegistryResourceRequests # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuCapacity # type: ignore - from ._models import SourceUploadedUserSourceInfo # type: ignore - from ._models import SsoProperties # type: ignore - from ._models import StackProperties # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageProperties # type: ignore - from ._models import StorageResource # type: ignore - from ._models import StorageResourceCollection # type: ignore - from ._models import SupportedBuildpackResource # type: ignore - from ._models import SupportedBuildpackResourceProperties # type: ignore - from ._models import SupportedBuildpacksCollection # type: ignore - from ._models import SupportedRuntimeVersion # type: ignore - from ._models import SupportedStackResource # type: ignore - from ._models import SupportedStackResourceProperties # type: ignore - from ._models import SupportedStacksCollection # type: ignore - from ._models import SystemData # type: ignore - from ._models import TemporaryDisk # type: ignore - from ._models import TestKeys # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import TriggeredBuildResult # type: ignore - from ._models import UploadedUserSourceInfo # type: ignore - from ._models import UserSourceInfo # type: ignore - from ._models import ValidationMessages # type: ignore +from ._models_py3 import ActiveDeploymentCollection +from ._models_py3 import ApiPortalCustomDomainProperties +from ._models_py3 import ApiPortalCustomDomainResource +from ._models_py3 import ApiPortalCustomDomainResourceCollection +from ._models_py3 import ApiPortalInstance +from ._models_py3 import ApiPortalProperties +from ._models_py3 import ApiPortalResource +from ._models_py3 import ApiPortalResourceCollection +from ._models_py3 import ApiPortalResourceRequests +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import AzureFileVolume +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import Build +from ._models_py3 import BuildCollection +from ._models_py3 import BuildProperties +from ._models_py3 import BuildResult +from ._models_py3 import BuildResultCollection +from ._models_py3 import BuildResultLog +from ._models_py3 import BuildResultProperties +from ._models_py3 import BuildResultUserSourceInfo +from ._models_py3 import BuildService +from ._models_py3 import BuildServiceAgentPoolProperties +from ._models_py3 import BuildServiceAgentPoolResource +from ._models_py3 import BuildServiceAgentPoolResourceCollection +from ._models_py3 import BuildServiceAgentPoolSizeProperties +from ._models_py3 import BuildServiceCollection +from ._models_py3 import BuildServiceProperties +from ._models_py3 import BuildServicePropertiesResourceRequests +from ._models_py3 import BuildStageProperties +from ._models_py3 import BuilderProperties +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceCollection +from ._models_py3 import BuildpackBindingLaunchProperties +from ._models_py3 import BuildpackBindingProperties +from ._models_py3 import BuildpackBindingResource +from ._models_py3 import BuildpackBindingResourceCollection +from ._models_py3 import BuildpackProperties +from ._models_py3 import BuildpacksGroupProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import ConfigurationServiceGitProperty +from ._models_py3 import ConfigurationServiceGitPropertyValidateResult +from ._models_py3 import ConfigurationServiceGitRepository +from ._models_py3 import ConfigurationServiceInstance +from ._models_py3 import ConfigurationServiceProperties +from ._models_py3 import ConfigurationServiceResource +from ._models_py3 import ConfigurationServiceResourceCollection +from ._models_py3 import ConfigurationServiceResourceRequests +from ._models_py3 import ConfigurationServiceSettings +from ._models_py3 import ConfigurationServiceSettingsValidateResult +from ._models_py3 import ContainerProbeSettings +from ._models_py3 import ContentCertificateProperties +from ._models_py3 import CustomContainer +from ._models_py3 import CustomContainerUserSourceInfo +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import CustomPersistentDiskProperties +from ._models_py3 import CustomPersistentDiskResource +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import DiagnosticParameters +from ._models_py3 import Error +from ._models_py3 import GatewayApiMetadataProperties +from ._models_py3 import GatewayApiRoute +from ._models_py3 import GatewayCorsProperties +from ._models_py3 import GatewayCustomDomainProperties +from ._models_py3 import GatewayCustomDomainResource +from ._models_py3 import GatewayCustomDomainResourceCollection +from ._models_py3 import GatewayInstance +from ._models_py3 import GatewayOperatorProperties +from ._models_py3 import GatewayOperatorResourceRequests +from ._models_py3 import GatewayProperties +from ._models_py3 import GatewayResource +from ._models_py3 import GatewayResourceCollection +from ._models_py3 import GatewayResourceRequests +from ._models_py3 import GatewayRouteConfigProperties +from ._models_py3 import GatewayRouteConfigResource +from ._models_py3 import GatewayRouteConfigResourceCollection +from ._models_py3 import GitPatternRepository +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import JarUploadedUserSourceInfo +from ._models_py3 import KeyVaultCertificateProperties +from ._models_py3 import LoadedCertificate +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetCoreZipUploadedUserSourceInfo +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceRequests +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import ServiceRegistryInstance +from ._models_py3 import ServiceRegistryProperties +from ._models_py3 import ServiceRegistryResource +from ._models_py3 import ServiceRegistryResourceCollection +from ._models_py3 import ServiceRegistryResourceRequests +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SourceUploadedUserSourceInfo +from ._models_py3 import SsoProperties +from ._models_py3 import StackProperties +from ._models_py3 import StorageAccount +from ._models_py3 import StorageProperties +from ._models_py3 import StorageResource +from ._models_py3 import StorageResourceCollection +from ._models_py3 import SupportedBuildpackResource +from ._models_py3 import SupportedBuildpackResourceProperties +from ._models_py3 import SupportedBuildpacksCollection +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import SupportedStackResource +from ._models_py3 import SupportedStackResourceProperties +from ._models_py3 import SupportedStacksCollection +from ._models_py3 import SystemData +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import TriggeredBuildResult +from ._models_py3 import UploadedUserSourceInfo +from ._models_py3 import UserSourceInfo +from ._models_py3 import ValidationMessages + from ._app_platform_management_client_enums import ( + ActionType, ApiPortalProvisioningState, AppResourceProvisioningState, BindingType, @@ -366,10 +200,12 @@ ResourceSkuRestrictionsType, ServiceRegistryProvisioningState, SkuScaleType, + StorageType, SupportedRuntimePlatform, SupportedRuntimeValue, TestKeyType, TrafficDirection, + Type, ) __all__ = [ @@ -539,6 +375,7 @@ 'UploadedUserSourceInfo', 'UserSourceInfo', 'ValidationMessages', + 'ActionType', 'ApiPortalProvisioningState', 'AppResourceProvisioningState', 'BindingType', @@ -563,8 +400,10 @@ 'ResourceSkuRestrictionsType', 'ServiceRegistryProvisioningState', 'SkuScaleType', + 'StorageType', 'SupportedRuntimePlatform', 'SupportedRuntimeValue', 'TestKeyType', 'TrafficDirection', + 'Type', ] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py index 6e80cf01dcd..b10f39b3966 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py @@ -6,27 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + INTERNAL = "Internal" -class ApiPortalProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApiPortalProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the API portal. """ @@ -36,7 +27,7 @@ class ApiPortalProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, E FAILED = "Failed" DELETING = "Deleting" -class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -46,7 +37,7 @@ class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, UPDATING = "Updating" DELETING = "Deleting" -class BindingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Buildpack Binding Type """ @@ -57,7 +48,7 @@ class BindingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NEW_RELIC = "NewRelic" ELASTIC_APM = "ElasticAPM" -class BuilderProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Builder provision status. """ @@ -67,7 +58,7 @@ class BuilderProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu FAILED = "Failed" DELETING = "Deleting" -class BuildpackBindingProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Buildpack Binding. """ @@ -77,7 +68,7 @@ class BuildpackBindingProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, FAILED = "Failed" DELETING = "Deleting" -class BuildProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the KPack build result """ @@ -87,7 +78,7 @@ class BuildProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) FAILED = "Failed" DELETING = "Deleting" -class BuildResultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the KPack build result """ @@ -97,7 +88,7 @@ class BuildResultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, FAILED = "Failed" DELETING = "Deleting" -class BuildServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the KPack build result """ @@ -107,7 +98,7 @@ class BuildServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str FAILED = "Failed" DELETING = "Deleting" -class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -117,7 +108,7 @@ class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ConfigurationServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Application Configuration Service. """ @@ -127,7 +118,7 @@ class ConfigurationServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumM FAILED = "Failed" DELETING = "Deleting" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -136,7 +127,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -145,14 +136,14 @@ class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMet SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ STOPPED = "Stopped" RUNNING = "Running" -class GatewayProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GatewayProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Spring Cloud Gateway. """ @@ -162,7 +153,7 @@ class GatewayProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu FAILED = "Failed" DELETING = "Deleting" -class KPackBuildStageProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of this build stage resource. """ @@ -171,7 +162,7 @@ class KPackBuildStageProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, SUCCEEDED = "Succeeded" FAILED = "Failed" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -180,7 +171,7 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -189,7 +180,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -198,19 +189,21 @@ class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class PowerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PowerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Power state of the Service """ RUNNING = "Running" STOPPED = "Stopped" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ CREATING = "Creating" UPDATING = "Updating" + STARTING = "Starting" + STOPPING = "Stopping" DELETING = "Deleting" DELETED = "Deleted" SUCCEEDED = "Succeeded" @@ -219,7 +212,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -227,14 +220,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class ServiceRegistryProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of the Service Registry. """ @@ -244,7 +237,7 @@ class ServiceRegistryProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, FAILED = "Failed" DELETING = "Deleting" -class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -252,14 +245,20 @@ class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the storage. + """ + + STORAGE_ACCOUNT = "StorageAccount" + +class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -268,16 +267,22 @@ class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) JAVA17 = "Java_17" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" + +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the underlying resource to mount as a persistent disk. + """ + + AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py index 85476a1acfc..03e80834738 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py @@ -17,8 +17,8 @@ class ActiveDeploymentCollection(msrest.serialization.Model): """Object that includes an array of Deployment resource name and set them as active. - :param active_deployment_names: Collection of Deployment name. - :type active_deployment_names: list[str] + :ivar active_deployment_names: Collection of Deployment name. + :vartype active_deployment_names: list[str] """ _attribute_map = { @@ -31,6 +31,10 @@ def __init__( active_deployment_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword active_deployment_names: Collection of Deployment name. + :paramtype active_deployment_names: list[str] + """ super(ActiveDeploymentCollection, self).__init__(**kwargs) self.active_deployment_names = active_deployment_names @@ -38,8 +42,8 @@ def __init__( class ApiPortalCustomDomainProperties(msrest.serialization.Model): """The properties of custom domain for API portal. - :param thumbprint: The thumbprint of bound certificate. - :type thumbprint: str + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str """ _attribute_map = { @@ -52,6 +56,10 @@ def __init__( thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ super(ApiPortalCustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint @@ -89,6 +97,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -129,6 +139,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -145,8 +157,8 @@ class ApiPortalCustomDomainResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: The properties of custom domain for API portal. - :type properties: + :ivar properties: The properties of custom domain for API portal. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainProperties """ @@ -171,6 +183,11 @@ def __init__( properties: Optional["ApiPortalCustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: The properties of custom domain for API portal. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainProperties + """ super(ApiPortalCustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -178,12 +195,12 @@ def __init__( class ApiPortalCustomDomainResourceCollection(msrest.serialization.Model): """Object that includes an array of API portal custom domain resources and a possible link for next set. - :param value: Collection of API portal custom domain resources. - :type value: + :ivar value: Collection of API portal custom domain resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -198,6 +215,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of API portal custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ApiPortalCustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -228,6 +253,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiPortalInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -242,18 +269,18 @@ class ApiPortalProperties(msrest.serialization.Model): "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProvisioningState - :param public: Indicates whether the API portal exposes endpoint. - :type public: bool + :ivar public: Indicates whether the API portal exposes endpoint. + :vartype public: bool :ivar url: URL of the API portal, exposed when 'public' is true. :vartype url: str - :param https_only: Indicate if only https is allowed. - :type https_only: bool - :param gateway_ids: The array of resource Ids of gateway to integrate with API portal. - :type gateway_ids: list[str] - :param source_urls: Collection of OpenAPI source URL locations. - :type source_urls: list[str] - :param sso_properties: Single sign-on related configuration. - :type sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :vartype gateway_ids: list[str] + :ivar source_urls: Collection of OpenAPI source URL locations. + :vartype source_urls: list[str] + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties :ivar resource_requests: The requested resource quantity for required CPU and Memory. :vartype resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceRequests @@ -283,13 +310,25 @@ class ApiPortalProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = None, - https_only: Optional[bool] = None, + public: Optional[bool] = False, + https_only: Optional[bool] = False, gateway_ids: Optional[List[str]] = None, source_urls: Optional[List[str]] = None, sso_properties: Optional["SsoProperties"] = None, **kwargs ): + """ + :keyword public: Indicates whether the API portal exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :paramtype gateway_ids: list[str] + :keyword source_urls: Collection of OpenAPI source URL locations. + :paramtype source_urls: list[str] + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + """ super(ApiPortalProperties, self).__init__(**kwargs) self.provisioning_state = None self.public = public @@ -315,10 +354,10 @@ class ApiPortalResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: API portal properties payload. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties - :param sku: Sku of the API portal resource. - :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :ivar properties: API portal properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties + :ivar sku: Sku of the API portal resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -344,6 +383,12 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: API portal properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties + :keyword sku: Sku of the API portal resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ super(ApiPortalResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -352,11 +397,11 @@ def __init__( class ApiPortalResourceCollection(msrest.serialization.Model): """Object that includes an array of API portal resources and a possible link for next set. - :param value: Collection of API portal resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of API portal resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -371,6 +416,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of API portal resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ApiPortalResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -401,6 +453,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApiPortalResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -427,6 +481,8 @@ def __init__( self, **kwargs ): + """ + """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -444,12 +500,12 @@ class AppResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the App resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProperties - :param identity: The Managed Identity type of the app resource. - :type identity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityProperties - :param location: The GEO location of the application, always the same with its parent resource. - :type location: str + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str """ _validation = { @@ -477,6 +533,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -486,11 +552,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of App resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -505,6 +571,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -515,31 +588,31 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param public: Indicates whether the App exposes public endpoint. - :type public: bool + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool :ivar url: URL of the App. :vartype url: str - :param addon_configs: Collection of addons. - :type addon_configs: dict[str, dict[str, any]] + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProvisioningState - :param fqdn: Fully qualified dns Name. - :type fqdn: str - :param https_only: Indicate if only https is allowed. - :type https_only: bool - :param temporary_disk: Temporary disk settings. - :type temporary_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TemporaryDisk - :param persistent_disk: Persistent disk settings. - :type persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk - :param custom_persistent_disks: List of custom persistent disks. - :type custom_persistent_disks: + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskResource] - :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :type enable_end_to_end_tls: bool - :param loaded_certificates: Collection of loaded certificates. - :type loaded_certificates: + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool + :ivar loaded_certificates: Collection of loaded certificates. + :vartype loaded_certificates: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LoadedCertificate] """ @@ -576,6 +649,28 @@ def __init__( loaded_certificates: Optional[List["LoadedCertificate"]] = None, **kwargs ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskResource] + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + :keyword loaded_certificates: Collection of loaded certificates. + :paramtype loaded_certificates: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LoadedCertificate] + """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -593,11 +688,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :param value: Collection of available operation details. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -612,6 +707,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -639,6 +741,8 @@ def __init__( self, **kwargs ): + """ + """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -651,15 +755,15 @@ class CustomPersistentDiskProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. - :type type: str - :param mount_path: Required. The mount path of the persistent disk. - :type mount_path: str - :param read_only: Indicates whether the persistent disk is a readOnly one. - :type read_only: bool - :param mount_options: These are the mount options for a persistent disk. - :type mount_options: list[str] + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.Type + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] """ _validation = { @@ -686,6 +790,14 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + """ super(CustomPersistentDiskProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.mount_path = mount_path @@ -698,17 +810,17 @@ class AzureFileVolume(CustomPersistentDiskProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. - :type type: str - :param mount_path: Required. The mount path of the persistent disk. - :type mount_path: str - :param read_only: Indicates whether the persistent disk is a readOnly one. - :type read_only: bool - :param mount_options: These are the mount options for a persistent disk. - :type mount_options: list[str] - :param share_name: Required. The share name of the Azure File share. - :type share_name: str + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.Type + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + :ivar share_name: Required. The share name of the Azure File share. + :vartype share_name: str """ _validation = { @@ -734,6 +846,16 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + :keyword share_name: Required. The share name of the Azure File share. + :paramtype share_name: str + """ super(AzureFileVolume, self).__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) self.type = 'AzureFileVolume' # type: str self.share_name = share_name @@ -752,8 +874,9 @@ class BindingResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the Binding resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties """ _validation = { @@ -777,6 +900,11 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties + """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -784,11 +912,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :param value: Collection of Binding resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -803,6 +931,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -817,12 +952,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :param resource_id: The Azure resource id of the bound resource. - :type resource_id: str - :param key: The key of the bound resource. - :type key: str - :param binding_parameters: Binding parameters of the Binding resource. - :type binding_parameters: dict[str, any] + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -859,6 +994,14 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -883,8 +1026,8 @@ class Build(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the build resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties """ _validation = { @@ -908,6 +1051,10 @@ def __init__( properties: Optional["BuildProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties + """ super(Build, self).__init__(**kwargs) self.properties = properties @@ -915,11 +1062,11 @@ def __init__( class BuildCollection(msrest.serialization.Model): """Object that includes an array of Build resources and a possible link for next set. - :param value: Collection of Build resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Build resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -934,6 +1081,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Build resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BuildCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -948,10 +1102,10 @@ class BuilderProperties(msrest.serialization.Model): "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProvisioningState - :param stack: Builder cluster stack property. - :type stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties - :param buildpack_groups: Builder buildpack groups. - :type buildpack_groups: + :ivar stack: Builder cluster stack property. + :vartype stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties + :ivar buildpack_groups: Builder buildpack groups. + :vartype buildpack_groups: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpacksGroupProperties] """ @@ -972,6 +1126,13 @@ def __init__( buildpack_groups: Optional[List["BuildpacksGroupProperties"]] = None, **kwargs ): + """ + :keyword stack: Builder cluster stack property. + :paramtype stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties + :keyword buildpack_groups: Builder buildpack groups. + :paramtype buildpack_groups: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpacksGroupProperties] + """ super(BuilderProperties, self).__init__(**kwargs) self.provisioning_state = None self.stack = stack @@ -991,8 +1152,8 @@ class BuilderResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Property of the Builder resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties + :ivar properties: Property of the Builder resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties """ _validation = { @@ -1016,6 +1177,10 @@ def __init__( properties: Optional["BuilderProperties"] = None, **kwargs ): + """ + :keyword properties: Property of the Builder resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties + """ super(BuilderResource, self).__init__(**kwargs) self.properties = properties @@ -1023,11 +1188,11 @@ def __init__( class BuilderResourceCollection(msrest.serialization.Model): """Object that includes an array of Builder resources and a possible link for next set. - :param value: Collection of Builder resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Builder resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1042,6 +1207,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Builder resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BuilderResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1050,10 +1222,10 @@ def __init__( class BuildpackBindingLaunchProperties(msrest.serialization.Model): """Buildpack Binding Launch Properties. - :param properties: Non-sensitive properties for launchProperties. - :type properties: dict[str, str] - :param secrets: Sensitive properties for launchProperties. - :type secrets: dict[str, str] + :ivar properties: Non-sensitive properties for launchProperties. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties for launchProperties. + :vartype secrets: dict[str, str] """ _attribute_map = { @@ -1068,6 +1240,12 @@ def __init__( secrets: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword properties: Non-sensitive properties for launchProperties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for launchProperties. + :paramtype secrets: dict[str, str] + """ super(BuildpackBindingLaunchProperties, self).__init__(**kwargs) self.properties = properties self.secrets = secrets @@ -1078,15 +1256,15 @@ class BuildpackBindingProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + :ivar binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". - :type binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType + :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType :ivar provisioning_state: State of the Buildpack Binding. Possible values include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProvisioningState - :param launch_properties: The object describes the buildpack binding launch properties. - :type launch_properties: + :ivar launch_properties: The object describes the buildpack binding launch properties. + :vartype launch_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingLaunchProperties """ @@ -1107,6 +1285,14 @@ def __init__( launch_properties: Optional["BuildpackBindingLaunchProperties"] = None, **kwargs ): + """ + :keyword binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". + :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType + :keyword launch_properties: The object describes the buildpack binding launch properties. + :paramtype launch_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingLaunchProperties + """ super(BuildpackBindingProperties, self).__init__(**kwargs) self.binding_type = binding_type self.provisioning_state = None @@ -1126,8 +1312,9 @@ class BuildpackBindingResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of a buildpack binding. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties + :ivar properties: Properties of a buildpack binding. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties """ _validation = { @@ -1151,6 +1338,11 @@ def __init__( properties: Optional["BuildpackBindingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of a buildpack binding. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties + """ super(BuildpackBindingResource, self).__init__(**kwargs) self.properties = properties @@ -1158,11 +1350,12 @@ def __init__( class BuildpackBindingResourceCollection(msrest.serialization.Model): """Object that includes an array of BuildpackBinding resources and a possible link for next set. - :param value: Collection of BuildpackBinding resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of BuildpackBinding resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1177,6 +1370,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of BuildpackBinding resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BuildpackBindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1185,8 +1386,8 @@ def __init__( class BuildpackProperties(msrest.serialization.Model): """Buildpack properties payload. - :param id: Id of the buildpack. - :type id: str + :ivar id: Id of the buildpack. + :vartype id: str """ _attribute_map = { @@ -1199,6 +1400,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Id of the buildpack. + :paramtype id: str + """ super(BuildpackProperties, self).__init__(**kwargs) self.id = id @@ -1206,10 +1411,11 @@ def __init__( class BuildpacksGroupProperties(msrest.serialization.Model): """Buildpack group properties of the Builder. - :param name: Buildpack group name. - :type name: str - :param buildpacks: Buildpacks in the buildpack group. - :type buildpacks: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] + :ivar name: Buildpack group name. + :vartype name: str + :ivar buildpacks: Buildpacks in the buildpack group. + :vartype buildpacks: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] """ _attribute_map = { @@ -1224,6 +1430,13 @@ def __init__( buildpacks: Optional[List["BuildpackProperties"]] = None, **kwargs ): + """ + :keyword name: Buildpack group name. + :paramtype name: str + :keyword buildpacks: Buildpacks in the buildpack group. + :paramtype buildpacks: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] + """ super(BuildpacksGroupProperties, self).__init__(**kwargs) self.name = name self.buildpacks = buildpacks @@ -1234,18 +1447,18 @@ class BuildProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param relative_path: The relative path of source code. - :type relative_path: str - :param builder: The resource id of builder to build the source code. - :type builder: str - :param agent_pool: The resource id of agent pool. - :type agent_pool: str + :ivar relative_path: The relative path of source code. + :vartype relative_path: str + :ivar builder: The resource id of builder to build the source code. + :vartype builder: str + :ivar agent_pool: The resource id of agent pool. + :vartype agent_pool: str :ivar provisioning_state: Provisioning state of the KPack build result. Possible values include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProvisioningState - :param env: The environment variables for this build. - :type env: dict[str, str] + :ivar env: The environment variables for this build. + :vartype env: dict[str, str] :ivar triggered_build_result: The build result triggered by this build. :vartype triggered_build_result: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TriggeredBuildResult @@ -1274,6 +1487,16 @@ def __init__( env: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword relative_path: The relative path of source code. + :paramtype relative_path: str + :keyword builder: The resource id of builder to build the source code. + :paramtype builder: str + :keyword agent_pool: The resource id of agent pool. + :paramtype agent_pool: str + :keyword env: The environment variables for this build. + :paramtype env: dict[str, str] + """ super(BuildProperties, self).__init__(**kwargs) self.relative_path = relative_path self.builder = builder @@ -1296,8 +1519,8 @@ class BuildResult(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the build result resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties + :ivar properties: Properties of the build result resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties """ _validation = { @@ -1321,6 +1544,10 @@ def __init__( properties: Optional["BuildResultProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the build result resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties + """ super(BuildResult, self).__init__(**kwargs) self.properties = properties @@ -1328,11 +1555,11 @@ def __init__( class BuildResultCollection(msrest.serialization.Model): """Object that includes an array of Build result resources and a possible link for next set. - :param value: Collection of Build result resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Build result resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1347,6 +1574,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Build result resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BuildResultCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1355,8 +1589,8 @@ def __init__( class BuildResultLog(msrest.serialization.Model): """Build result log resource properties payload. - :param blob_url: The public download URL of this build result log. - :type blob_url: str + :ivar blob_url: The public download URL of this build result log. + :vartype blob_url: str """ _attribute_map = { @@ -1369,6 +1603,10 @@ def __init__( blob_url: Optional[str] = None, **kwargs ): + """ + :keyword blob_url: The public download URL of this build result log. + :paramtype blob_url: str + """ super(BuildResultLog, self).__init__(**kwargs) self.blob_url = blob_url @@ -1378,14 +1616,14 @@ class BuildResultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The name of this build result. - :type name: str + :ivar name: The name of this build result. + :vartype name: str :ivar provisioning_state: Provisioning state of the KPack build result. Possible values include: "Queuing", "Building", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProvisioningState - :param build_pod_name: The build pod name which can be used to get the build log streaming. - :type build_pod_name: str + :ivar build_pod_name: The build pod name which can be used to get the build log streaming. + :vartype build_pod_name: str :ivar build_stages: All of the build stage (init-container and container) resources in build pod. :vartype build_stages: @@ -1411,6 +1649,12 @@ def __init__( build_pod_name: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of this build result. + :paramtype name: str + :keyword build_pod_name: The build pod name which can be used to get the build log streaming. + :paramtype build_pod_name: str + """ super(BuildResultProperties, self).__init__(**kwargs) self.name = name self.provisioning_state = None @@ -1426,10 +1670,10 @@ class UserSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the source uploaded.Constant filled by server. - :type type: str - :param version: Version of the source. - :type version: str + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str """ _validation = { @@ -1451,6 +1695,10 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword version: Version of the source. + :paramtype version: str + """ super(UserSourceInfo, self).__init__(**kwargs) self.type = None # type: Optional[str] self.version = version @@ -1461,13 +1709,13 @@ class BuildResultUserSourceInfo(UserSourceInfo): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the source uploaded.Constant filled by server. - :type type: str - :param version: Version of the source. - :type version: str - :param build_result_id: Resource id of an existing succeeded build result under the same Spring + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring instance. - :type build_result_id: str + :vartype build_result_id: str """ _validation = { @@ -1487,6 +1735,13 @@ def __init__( build_result_id: Optional[str] = None, **kwargs ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword build_result_id: Resource id of an existing succeeded build result under the same + Spring instance. + :paramtype build_result_id: str + """ super(BuildResultUserSourceInfo, self).__init__(version=version, **kwargs) self.type = 'BuildResult' # type: str self.build_result_id = build_result_id @@ -1505,8 +1760,8 @@ class BuildService(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the build resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties """ _validation = { @@ -1530,6 +1785,11 @@ def __init__( properties: Optional["BuildServiceProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties + """ super(BuildService, self).__init__(**kwargs) self.properties = properties @@ -1541,8 +1801,8 @@ class BuildServiceAgentPoolProperties(msrest.serialization.Model): :ivar provisioning_state: Provisioning state of the build service agent pool. :vartype provisioning_state: str - :param pool_size: build service agent pool size properties. - :type pool_size: + :ivar pool_size: build service agent pool size properties. + :vartype pool_size: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties """ @@ -1561,6 +1821,11 @@ def __init__( pool_size: Optional["BuildServiceAgentPoolSizeProperties"] = None, **kwargs ): + """ + :keyword pool_size: build service agent pool size properties. + :paramtype pool_size: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties + """ super(BuildServiceAgentPoolProperties, self).__init__(**kwargs) self.provisioning_state = None self.pool_size = pool_size @@ -1579,8 +1844,8 @@ class BuildServiceAgentPoolResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: build service agent pool properties. - :type properties: + :ivar properties: build service agent pool properties. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolProperties """ @@ -1605,6 +1870,11 @@ def __init__( properties: Optional["BuildServiceAgentPoolProperties"] = None, **kwargs ): + """ + :keyword properties: build service agent pool properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolProperties + """ super(BuildServiceAgentPoolResource, self).__init__(**kwargs) self.properties = properties @@ -1612,12 +1882,12 @@ def __init__( class BuildServiceAgentPoolResourceCollection(msrest.serialization.Model): """Object that includes an array of build service agent pool resources and a possible link for next set. - :param value: Collection of build service agent pool resource. - :type value: + :ivar value: Collection of build service agent pool resource. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1632,6 +1902,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of build service agent pool resource. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BuildServiceAgentPoolResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1642,8 +1920,8 @@ class BuildServiceAgentPoolSizeProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: The name of build service agent pool size. - :type name: str + :ivar name: The name of build service agent pool size. + :vartype name: str :ivar cpu: The cpu property of build service agent pool size. :vartype cpu: str :ivar memory: The memory property of build service agent pool size. @@ -1667,6 +1945,10 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of build service agent pool size. + :paramtype name: str + """ super(BuildServiceAgentPoolSizeProperties, self).__init__(**kwargs) self.name = name self.cpu = None @@ -1676,11 +1958,11 @@ def __init__( class BuildServiceCollection(msrest.serialization.Model): """Object that includes an array of Build service resources and a possible link for next set. - :param value: Collection of Build service resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Build service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -1695,6 +1977,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Build service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(BuildServiceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1705,14 +1994,14 @@ class BuildServiceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param k_pack_version: The installed KPack version in this build service. - :type k_pack_version: str + :ivar k_pack_version: The installed KPack version in this build service. + :vartype k_pack_version: str :ivar provisioning_state: Provisioning state of the KPack build result. Possible values include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProvisioningState - :param resource_requests: The runtime resource configuration of this build service. - :type resource_requests: + :ivar resource_requests: The runtime resource configuration of this build service. + :vartype resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServicePropertiesResourceRequests """ @@ -1733,6 +2022,13 @@ def __init__( resource_requests: Optional["BuildServicePropertiesResourceRequests"] = None, **kwargs ): + """ + :keyword k_pack_version: The installed KPack version in this build service. + :paramtype k_pack_version: str + :keyword resource_requests: The runtime resource configuration of this build service. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServicePropertiesResourceRequests + """ super(BuildServiceProperties, self).__init__(**kwargs) self.k_pack_version = k_pack_version self.provisioning_state = None @@ -1764,6 +2060,8 @@ def __init__( self, **kwargs ): + """ + """ super(BuildServicePropertiesResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -1796,6 +2094,8 @@ def __init__( self, **kwargs ): + """ + """ super(BuildStageProperties, self).__init__(**kwargs) self.name = None self.status = None @@ -1811,8 +2111,8 @@ class CertificateProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the certificate source.Constant filled by server. - :type type: str + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -1859,6 +2159,8 @@ def __init__( self, **kwargs ): + """ + """ super(CertificateProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.thumbprint = None @@ -1883,8 +2185,8 @@ class CertificateResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the certificate resource payload. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties """ _validation = { @@ -1908,6 +2210,10 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties + """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -1915,10 +2221,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :param value: The certificate resources list. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :param next_link: The link to next page of certificate list. - :type next_link: str + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str """ _attribute_map = { @@ -1933,6 +2239,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1941,17 +2253,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -1970,6 +2282,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1983,20 +2308,20 @@ class ClusterResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Provisioning state of the Service. Possible values include: - "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", - "MoveFailed". + "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", + "Moving", "Moved", "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ProvisioningState - :param network_profile: Network profile of the Service. - :type network_profile: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfile + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str :ivar power_state: Power state of the Service. Possible values include: "Running", "Stopped". :vartype power_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.PowerState - :param zone_redundant: - :type zone_redundant: bool + :ivar zone_redundant: + :vartype zone_redundant: bool :ivar fqdn: Fully qualified dns name of the service instance. :vartype fqdn: str """ @@ -2026,6 +2351,12 @@ def __init__( zone_redundant: Optional[bool] = False, **kwargs ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfile + :keyword zone_redundant: + :paramtype zone_redundant: bool + """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -2041,27 +2372,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param repositories: Repositories of git. - :type repositories: + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GitPatternRepository] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -2096,6 +2427,29 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -2118,10 +2472,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerState - :param error: Error when apply config server settings. - :type error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error - :param config_server: Settings of config server. - :type config_server: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings """ _validation = { @@ -2141,6 +2495,13 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings + """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -2160,8 +2521,8 @@ class ConfigServerResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the Config Server resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties """ _validation = { @@ -2185,6 +2546,11 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties + """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -2192,8 +2558,9 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :param git_property: Property of git environment. - :type git_property: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerGitProperty + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -2206,6 +2573,11 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerGitProperty + """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -2213,12 +2585,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :param name: The name of the config server settings error record. - :type name: str - :param uri: The uri of the config server settings error record. - :type uri: str - :param messages: The detail error messages of the record. - :type messages: list[str] + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] """ _attribute_map = { @@ -2235,6 +2607,14 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -2244,10 +2624,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :param is_valid: Indicate if the config server settings are valid. - :type is_valid: bool - :param details: The detail validation results. - :type details: + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -2263,6 +2643,13 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsErrorRecord] + """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -2271,8 +2658,8 @@ def __init__( class ConfigurationServiceGitProperty(msrest.serialization.Model): """Property of git environment. - :param repositories: Repositories of Application Configuration Service git property. - :type repositories: + :ivar repositories: Repositories of Application Configuration Service git property. + :vartype repositories: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitRepository] """ @@ -2286,6 +2673,11 @@ def __init__( repositories: Optional[List["ConfigurationServiceGitRepository"]] = None, **kwargs ): + """ + :keyword repositories: Repositories of Application Configuration Service git property. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitRepository] + """ super(ConfigurationServiceGitProperty, self).__init__(**kwargs) self.repositories = repositories @@ -2293,10 +2685,10 @@ def __init__( class ConfigurationServiceGitPropertyValidateResult(msrest.serialization.Model): """Validation result for configuration service settings. - :param is_valid: Indicate if the configuration service settings are valid. - :type is_valid: bool - :param git_repos_validation_result: The detail validation results. - :type git_repos_validation_result: + :ivar is_valid: Indicate if the configuration service settings are valid. + :vartype is_valid: bool + :ivar git_repos_validation_result: The detail validation results. + :vartype git_repos_validation_result: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ValidationMessages] """ @@ -2312,6 +2704,13 @@ def __init__( git_repos_validation_result: Optional[List["ValidationMessages"]] = None, **kwargs ): + """ + :keyword is_valid: Indicate if the configuration service settings are valid. + :paramtype is_valid: bool + :keyword git_repos_validation_result: The detail validation results. + :paramtype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ValidationMessages] + """ super(ConfigurationServiceGitPropertyValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.git_repos_validation_result = git_repos_validation_result @@ -2322,28 +2721,28 @@ class ConfigurationServiceGitRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param patterns: Required. Collection of patterns of the repository. - :type patterns: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Required. Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar patterns: Required. Collection of patterns of the repository. + :vartype patterns: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Required. Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -2383,6 +2782,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword patterns: Required. Collection of patterns of the repository. + :paramtype patterns: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Required. Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(ConfigurationServiceGitRepository, self).__init__(**kwargs) self.name = name self.patterns = patterns @@ -2422,6 +2845,8 @@ def __init__( self, **kwargs ): + """ + """ super(ConfigurationServiceInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -2442,8 +2867,9 @@ class ConfigurationServiceProperties(msrest.serialization.Model): :ivar instances: Collection of instances belong to Application Configuration Service. :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceInstance] - :param settings: The settings of Application Configuration Service. - :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings + :ivar settings: The settings of Application Configuration Service. + :vartype settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings """ _validation = { @@ -2465,6 +2891,11 @@ def __init__( settings: Optional["ConfigurationServiceSettings"] = None, **kwargs ): + """ + :keyword settings: The settings of Application Configuration Service. + :paramtype settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings + """ super(ConfigurationServiceProperties, self).__init__(**kwargs) self.provisioning_state = None self.resource_requests = None @@ -2485,8 +2916,8 @@ class ConfigurationServiceResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Application Configuration Service properties payload. - :type properties: + :ivar properties: Application Configuration Service properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProperties """ @@ -2511,6 +2942,11 @@ def __init__( properties: Optional["ConfigurationServiceProperties"] = None, **kwargs ): + """ + :keyword properties: Application Configuration Service properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProperties + """ super(ConfigurationServiceResource, self).__init__(**kwargs) self.properties = properties @@ -2518,12 +2954,12 @@ def __init__( class ConfigurationServiceResourceCollection(msrest.serialization.Model): """Object that includes an array of configuration service resources and a possible link for next set. - :param value: Collection of configuration service resources. - :type value: + :ivar value: Collection of configuration service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -2538,6 +2974,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of configuration service resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ConfigurationServiceResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2572,6 +3016,8 @@ def __init__( self, **kwargs ): + """ + """ super(ConfigurationServiceResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -2581,8 +3027,8 @@ def __init__( class ConfigurationServiceSettings(msrest.serialization.Model): """The settings of Application Configuration Service. - :param git_property: Property of git environment. - :type git_property: + :ivar git_property: Property of git environment. + :vartype git_property: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitProperty """ @@ -2596,6 +3042,11 @@ def __init__( git_property: Optional["ConfigurationServiceGitProperty"] = None, **kwargs ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitProperty + """ super(ConfigurationServiceSettings, self).__init__(**kwargs) self.git_property = git_property @@ -2603,8 +3054,8 @@ def __init__( class ConfigurationServiceSettingsValidateResult(msrest.serialization.Model): """Validation result for configuration service settings. - :param git_property_validation_result: Validation result for configuration service settings. - :type git_property_validation_result: + :ivar git_property_validation_result: Validation result for configuration service settings. + :vartype git_property_validation_result: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult """ @@ -2618,6 +3069,11 @@ def __init__( git_property_validation_result: Optional["ConfigurationServiceGitPropertyValidateResult"] = None, **kwargs ): + """ + :keyword git_property_validation_result: Validation result for configuration service settings. + :paramtype git_property_validation_result: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult + """ super(ConfigurationServiceSettingsValidateResult, self).__init__(**kwargs) self.git_property_validation_result = git_property_validation_result @@ -2625,8 +3081,8 @@ def __init__( class ContainerProbeSettings(msrest.serialization.Model): """Container liveness and readiness probe settings. - :param disable_probe: Indicates whether disable the liveness and readiness probe. - :type disable_probe: bool + :ivar disable_probe: Indicates whether disable the liveness and readiness probe. + :vartype disable_probe: bool """ _attribute_map = { @@ -2639,6 +3095,10 @@ def __init__( disable_probe: Optional[bool] = None, **kwargs ): + """ + :keyword disable_probe: Indicates whether disable the liveness and readiness probe. + :paramtype disable_probe: bool + """ super(ContainerProbeSettings, self).__init__(**kwargs) self.disable_probe = disable_probe @@ -2650,8 +3110,8 @@ class ContentCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the certificate source.Constant filled by server. - :type type: str + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -2666,8 +3126,8 @@ class ContentCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :param content: Required. The content of uploaded certificate. - :type content: str + :ivar content: The content of uploaded certificate. + :vartype content: str """ _validation = { @@ -2679,7 +3139,6 @@ class ContentCertificateProperties(CertificateProperties): 'activate_date': {'readonly': True}, 'subject_name': {'readonly': True}, 'dns_names': {'readonly': True}, - 'content': {'required': True}, } _attribute_map = { @@ -2697,9 +3156,13 @@ class ContentCertificateProperties(CertificateProperties): def __init__( self, *, - content: str, + content: Optional[str] = None, **kwargs ): + """ + :keyword content: The content of uploaded certificate. + :paramtype content: str + """ super(ContentCertificateProperties, self).__init__(**kwargs) self.type = 'ContentCertificate' # type: str self.content = content @@ -2708,19 +3171,19 @@ def __init__( class CustomContainer(msrest.serialization.Model): """Custom container payload. - :param server: The name of the registry that contains the container image. - :type server: str - :param container_image: Container image of the custom container. This should be in the form of + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar container_image: Container image of the custom container. This should be in the form of :code:``::code:`` without the server name of the registry. - :type container_image: str - :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + :vartype container_image: str + :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. - :type command: list[str] - :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not + :vartype command: list[str] + :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not provided. - :type args: list[str] - :param image_registry_credential: Credential of the image registry. - :type image_registry_credential: + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ImageRegistryCredential """ @@ -2742,6 +3205,22 @@ def __init__( image_registry_credential: Optional["ImageRegistryCredential"] = None, **kwargs ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ImageRegistryCredential + """ super(CustomContainer, self).__init__(**kwargs) self.server = server self.container_image = container_image @@ -2755,12 +3234,12 @@ class CustomContainerUserSourceInfo(UserSourceInfo): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the source uploaded.Constant filled by server. - :type type: str - :param version: Version of the source. - :type version: str - :param custom_container: Custom container payload. - :type custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer """ _validation = { @@ -2780,6 +3259,12 @@ def __init__( custom_container: Optional["CustomContainer"] = None, **kwargs ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer + """ super(CustomContainerUserSourceInfo, self).__init__(version=version, **kwargs) self.type = 'Container' # type: str self.custom_container = custom_container @@ -2790,12 +3275,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param thumbprint: The thumbprint of bound certificate. - :type thumbprint: str + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :param cert_name: The bound certificate name of domain. - :type cert_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str """ _validation = { @@ -2815,6 +3300,12 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -2834,8 +3325,8 @@ class CustomDomainResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the custom domain resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties """ _validation = { @@ -2859,6 +3350,11 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties + """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -2866,10 +3362,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :param value: The custom domain resources list. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :param next_link: The link to next page of custom domain list. - :type next_link: str + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str """ _attribute_map = { @@ -2884,6 +3380,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2894,8 +3396,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name to be validated. - :type name: str + :ivar name: Required. Name to be validated. + :vartype name: str """ _validation = { @@ -2912,6 +3414,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -2919,10 +3425,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :param is_valid: Indicates if domain name is valid. - :type is_valid: bool - :param message: Message of why domain name is invalid. - :type message: str + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str """ _attribute_map = { @@ -2937,6 +3443,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -2947,12 +3459,12 @@ class CustomPersistentDiskResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param custom_persistent_disk_properties: Properties of the custom persistent disk resource + :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource payload. - :type custom_persistent_disk_properties: + :vartype custom_persistent_disk_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskProperties - :param storage_id: Required. The resource id of Azure Spring Cloud Storage resource. - :type storage_id: str + :ivar storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :vartype storage_id: str """ _validation = { @@ -2971,6 +3483,14 @@ def __init__( custom_persistent_disk_properties: Optional["CustomPersistentDiskProperties"] = None, **kwargs ): + """ + :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :paramtype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskProperties + :keyword storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :paramtype storage_id: str + """ super(CustomPersistentDiskResource, self).__init__(**kwargs) self.custom_persistent_disk_properties = custom_persistent_disk_properties self.storage_id = storage_id @@ -3017,6 +3537,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -3039,11 +3561,11 @@ class DeploymentResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the Deployment resource. - :type properties: + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceProperties - :param sku: Sku of the Deployment resource. - :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -3069,6 +3591,13 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -3077,11 +3606,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :param value: Collection of Deployment resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -3096,6 +3625,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3106,10 +3642,10 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param source: Uploaded source information of the deployment. - :type source: ~azure.mgmt.appplatform.v2022_01_01_preview.models.UserSourceInfo - :param deployment_settings: Deployment settings of the Deployment. - :type deployment_settings: + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2022_01_01_preview.models.UserSourceInfo + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -3118,8 +3654,8 @@ class DeploymentResourceProperties(msrest.serialization.Model): :ivar status: Status of the Deployment. Possible values include: "Stopped", "Running". :vartype status: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceStatus - :param active: Indicates whether the Deployment is active. - :type active: bool + :ivar active: Indicates whether the Deployment is active. + :vartype active: bool :ivar instances: Collection of instances belong to the Deployment. :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentInstance] """ @@ -3147,6 +3683,15 @@ def __init__( active: Optional[bool] = None, **kwargs ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2022_01_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentSettings + :keyword active: Indicates whether the Deployment is active. + :paramtype active: bool + """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.deployment_settings = deployment_settings @@ -3159,16 +3704,16 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :param resource_requests: The requested resource quantity for required CPU and Memory. It is + :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. - :type resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceRequests - :param environment_variables: Collection of environment variables. - :type environment_variables: dict[str, str] - :param addon_configs: Collection of addons. - :type addon_configs: dict[str, dict[str, any]] - :param container_probe_settings: Container liveness and readiness probe settings. - :type container_probe_settings: + :vartype resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceRequests + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ContainerProbeSettings """ @@ -3188,6 +3733,20 @@ def __init__( container_probe_settings: Optional["ContainerProbeSettings"] = None, **kwargs ): + """ + :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceRequests + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ContainerProbeSettings + """ super(DeploymentSettings, self).__init__(**kwargs) self.resource_requests = resource_requests self.environment_variables = environment_variables @@ -3198,12 +3757,12 @@ def __init__( class DiagnosticParameters(msrest.serialization.Model): """Diagnostic parameters of diagnostic operations. - :param app_instance: App instance name. - :type app_instance: str - :param file_path: Your target file path in your own BYOS. - :type file_path: str - :param duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :type duration: str + :ivar app_instance: App instance name. + :vartype app_instance: str + :ivar file_path: Your target file path in your own BYOS. + :vartype file_path: str + :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :vartype duration: str """ _attribute_map = { @@ -3220,6 +3779,14 @@ def __init__( duration: Optional[str] = None, **kwargs ): + """ + :keyword app_instance: App instance name. + :paramtype app_instance: str + :keyword file_path: Your target file path in your own BYOS. + :paramtype file_path: str + :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :paramtype duration: str + """ super(DiagnosticParameters, self).__init__(**kwargs) self.app_instance = app_instance self.file_path = file_path @@ -3229,10 +3796,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :param code: The code of error. - :type code: str - :param message: The message of error. - :type message: str + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str """ _attribute_map = { @@ -3247,6 +3814,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -3255,20 +3828,19 @@ def __init__( class GatewayApiMetadataProperties(msrest.serialization.Model): """API metadata property for Spring Cloud Gateway. - :param title: Title describing the context of the APIs available on the Gateway instance + :ivar title: Title describing the context of the APIs available on the Gateway instance (default: ``Spring Cloud Gateway for K8S``\ ). - :type title: str - :param description: Detailed description of the APIs available on the Gateway instance - (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). - :type description: str - :param documentation: Location of additional documentation for the APIs available on the - Gateway instance. - :type documentation: str - :param version: Version of APIs available on this Gateway instance (default: ``unspecified``\ - ). - :type version: str - :param server_url: Base URL that API consumers will use to access APIs on the Gateway instance. - :type server_url: str + :vartype title: str + :ivar description: Detailed description of the APIs available on the Gateway instance (default: + ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :vartype description: str + :ivar documentation: Location of additional documentation for the APIs available on the Gateway + instance. + :vartype documentation: str + :ivar version: Version of APIs available on this Gateway instance (default: ``unspecified``\ ). + :vartype version: str + :ivar server_url: Base URL that API consumers will use to access APIs on the Gateway instance. + :vartype server_url: str """ _attribute_map = { @@ -3289,6 +3861,23 @@ def __init__( server_url: Optional[str] = None, **kwargs ): + """ + :keyword title: Title describing the context of the APIs available on the Gateway instance + (default: ``Spring Cloud Gateway for K8S``\ ). + :paramtype title: str + :keyword description: Detailed description of the APIs available on the Gateway instance + (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :paramtype description: str + :keyword documentation: Location of additional documentation for the APIs available on the + Gateway instance. + :paramtype documentation: str + :keyword version: Version of APIs available on this Gateway instance (default: ``unspecified``\ + ). + :paramtype version: str + :keyword server_url: Base URL that API consumers will use to access APIs on the Gateway + instance. + :paramtype server_url: str + """ super(GatewayApiMetadataProperties, self).__init__(**kwargs) self.title = title self.description = description @@ -3300,30 +3889,30 @@ def __init__( class GatewayApiRoute(msrest.serialization.Model): """API route config of the Spring Cloud Gateway. - :param title: A title, will be applied to methods in the generated OpenAPI documentation. - :type title: str - :param description: A description, will be applied to methods in the generated OpenAPI + :ivar title: A title, will be applied to methods in the generated OpenAPI documentation. + :vartype title: str + :ivar description: A description, will be applied to methods in the generated OpenAPI documentation. - :type description: str - :param uri: Full uri, will override ``appName``. - :type uri: str - :param sso_enabled: Enable sso validation. - :type sso_enabled: bool - :param token_relay: Pass currently-authenticated user's identity token to application service, + :vartype description: str + :ivar uri: Full uri, will override ``appName``. + :vartype uri: str + :ivar sso_enabled: Enable sso validation. + :vartype sso_enabled: bool + :ivar token_relay: Pass currently-authenticated user's identity token to application service, default is 'false'. - :type token_relay: bool - :param predicates: A number of conditions to evaluate a route for each request. Each predicate + :vartype token_relay: bool + :ivar predicates: A number of conditions to evaluate a route for each request. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request. - :type predicates: list[str] - :param filters: To modify the request before sending it to the target endpoint, or the received + :vartype predicates: list[str] + :ivar filters: To modify the request before sending it to the target endpoint, or the received response. - :type filters: list[str] - :param order: Route processing order. - :type order: int - :param tags: A set of tags. Classification tags, will be applied to methods in the generated + :vartype filters: list[str] + :ivar order: Route processing order. + :vartype order: int + :ivar tags: A set of tags. Classification tags, will be applied to methods in the generated OpenAPI documentation. - :type tags: list[str] + :vartype tags: list[str] """ _attribute_map = { @@ -3352,6 +3941,32 @@ def __init__( tags: Optional[List[str]] = None, **kwargs ): + """ + :keyword title: A title, will be applied to methods in the generated OpenAPI documentation. + :paramtype title: str + :keyword description: A description, will be applied to methods in the generated OpenAPI + documentation. + :paramtype description: str + :keyword uri: Full uri, will override ``appName``. + :paramtype uri: str + :keyword sso_enabled: Enable sso validation. + :paramtype sso_enabled: bool + :keyword token_relay: Pass currently-authenticated user's identity token to application + service, default is 'false'. + :paramtype token_relay: bool + :keyword predicates: A number of conditions to evaluate a route for each request. Each + predicate may be evaluated against request headers and parameter values. All of the predicates + associated with a route must evaluate to true for the route to be matched to the request. + :paramtype predicates: list[str] + :keyword filters: To modify the request before sending it to the target endpoint, or the + received response. + :paramtype filters: list[str] + :keyword order: Route processing order. + :paramtype order: int + :keyword tags: A set of tags. Classification tags, will be applied to methods in the generated + OpenAPI documentation. + :paramtype tags: list[str] + """ super(GatewayApiRoute, self).__init__(**kwargs) self.title = title self.description = description @@ -3367,23 +3982,23 @@ def __init__( class GatewayCorsProperties(msrest.serialization.Model): """Cross-Origin Resource Sharing property. - :param allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + :ivar allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` allows all domains. - :type allowed_origins: list[str] - :param allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + :vartype allowed_origins: list[str] + :ivar allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. - :type allowed_methods: list[str] - :param allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows + :vartype allowed_methods: list[str] + :ivar allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows actual requests to send any header. - :type allowed_headers: list[str] - :param max_age: How long, in seconds, the response from a pre-flight request can be cached by + :vartype allowed_headers: list[str] + :ivar max_age: How long, in seconds, the response from a pre-flight request can be cached by clients. - :type max_age: int - :param allow_credentials: Whether user credentials are supported on cross-site requests. Valid + :vartype max_age: int + :ivar allow_credentials: Whether user credentials are supported on cross-site requests. Valid values: ``true``\ , ``false``. - :type allow_credentials: bool - :param exposed_headers: HTTP response headers to expose for cross-site requests. - :type exposed_headers: list[str] + :vartype allow_credentials: bool + :ivar exposed_headers: HTTP response headers to expose for cross-site requests. + :vartype exposed_headers: list[str] """ _attribute_map = { @@ -3406,6 +4021,25 @@ def __init__( exposed_headers: Optional[List[str]] = None, **kwargs ): + """ + :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. + :paramtype allowed_methods: list[str] + :keyword allowed_headers: Allowed headers in cross-site requests. The special value ``*`` + allows actual requests to send any header. + :paramtype allowed_headers: list[str] + :keyword max_age: How long, in seconds, the response from a pre-flight request can be cached by + clients. + :paramtype max_age: int + :keyword allow_credentials: Whether user credentials are supported on cross-site requests. + Valid values: ``true``\ , ``false``. + :paramtype allow_credentials: bool + :keyword exposed_headers: HTTP response headers to expose for cross-site requests. + :paramtype exposed_headers: list[str] + """ super(GatewayCorsProperties, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -3418,8 +4052,8 @@ def __init__( class GatewayCustomDomainProperties(msrest.serialization.Model): """The properties of custom domain for Spring Cloud Gateway. - :param thumbprint: The thumbprint of bound certificate. - :type thumbprint: str + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str """ _attribute_map = { @@ -3432,6 +4066,10 @@ def __init__( thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ super(GatewayCustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint @@ -3449,8 +4087,8 @@ class GatewayCustomDomainResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: The properties of custom domain for Spring Cloud Gateway. - :type properties: + :ivar properties: The properties of custom domain for Spring Cloud Gateway. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainProperties """ @@ -3475,6 +4113,11 @@ def __init__( properties: Optional["GatewayCustomDomainProperties"] = None, **kwargs ): + """ + :keyword properties: The properties of custom domain for Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainProperties + """ super(GatewayCustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -3482,12 +4125,12 @@ def __init__( class GatewayCustomDomainResourceCollection(msrest.serialization.Model): """Object that includes an array of Spring Cloud Gateway custom domain resources and a possible link for next set. - :param value: Collection of Spring Cloud Gateway custom domain resources. - :type value: + :ivar value: Collection of Spring Cloud Gateway custom domain resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -3502,6 +4145,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Spring Cloud Gateway custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(GatewayCustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3532,6 +4183,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewayInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -3563,6 +4216,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewayOperatorProperties, self).__init__(**kwargs) self.resource_requests = None self.instances = None @@ -3597,6 +4252,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewayOperatorResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -3612,21 +4269,22 @@ class GatewayProperties(msrest.serialization.Model): "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProvisioningState - :param public: Indicates whether the Spring Cloud Gateway exposes endpoint. - :type public: bool + :ivar public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :vartype public: bool :ivar url: URL of the Spring Cloud Gateway, exposed when 'public' is true. :vartype url: str - :param https_only: Indicate if only https is allowed. - :type https_only: bool - :param sso_properties: Single sign-on related configuration. - :type sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties - :param api_metadata_properties: API metadata property for Spring Cloud Gateway. - :type api_metadata_properties: + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. + :vartype api_metadata_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiMetadataProperties - :param cors_properties: Cross-Origin Resource Sharing property. - :type cors_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties - :param resource_requests: The requested resource quantity for required CPU and Memory. - :type resource_requests: + :ivar cors_properties: Cross-Origin Resource Sharing property. + :vartype cors_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceRequests :ivar instances: Collection of instances belong to Spring Cloud Gateway. :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayInstance] @@ -3658,14 +4316,31 @@ class GatewayProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = None, - https_only: Optional[bool] = None, + public: Optional[bool] = False, + https_only: Optional[bool] = False, sso_properties: Optional["SsoProperties"] = None, api_metadata_properties: Optional["GatewayApiMetadataProperties"] = None, cors_properties: Optional["GatewayCorsProperties"] = None, resource_requests: Optional["GatewayResourceRequests"] = None, **kwargs ): + """ + :keyword public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. + :paramtype api_metadata_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiMetadataProperties + :keyword cors_properties: Cross-Origin Resource Sharing property. + :paramtype cors_properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties + :keyword resource_requests: The requested resource quantity for required CPU and Memory. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceRequests + """ super(GatewayProperties, self).__init__(**kwargs) self.provisioning_state = None self.public = public @@ -3692,10 +4367,10 @@ class GatewayResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Spring Cloud Gateway properties payload. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties - :param sku: Sku of the Spring Cloud Gateway resource. - :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :ivar properties: Spring Cloud Gateway properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties + :ivar sku: Sku of the Spring Cloud Gateway resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -3721,6 +4396,12 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword properties: Spring Cloud Gateway properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties + :keyword sku: Sku of the Spring Cloud Gateway resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ super(GatewayResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -3729,11 +4410,11 @@ def __init__( class GatewayResourceCollection(msrest.serialization.Model): """Object that includes an array of gateway resources and a possible link for next set. - :param value: Collection of gateway resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of gateway resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -3748,6 +4429,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of gateway resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(GatewayResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3756,10 +4444,10 @@ def __init__( class GatewayResourceRequests(msrest.serialization.Model): """Resource request payload of Spring Cloud Gateway. - :param cpu: Cpu allocated to each Spring Cloud Gateway instance. - :type cpu: str - :param memory: Memory allocated to each Spring Cloud Gateway instance. - :type memory: str + :ivar cpu: Cpu allocated to each Spring Cloud Gateway instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Spring Cloud Gateway instance. + :vartype memory: str """ _attribute_map = { @@ -3774,6 +4462,12 @@ def __init__( memory: Optional[str] = None, **kwargs ): + """ + :keyword cpu: Cpu allocated to each Spring Cloud Gateway instance. + :paramtype cpu: str + :keyword memory: Memory allocated to each Spring Cloud Gateway instance. + :paramtype memory: str + """ super(GatewayResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -3788,12 +4482,12 @@ class GatewayRouteConfigProperties(msrest.serialization.Model): include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProvisioningState - :param app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route + :ivar app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route defines ``uri``. - :type app_resource_id: str - :param routes: Array of API routes, each route contains properties such as ``title``\ , - ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. - :type routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] + :vartype app_resource_id: str + :ivar routes: Array of API routes, each route contains properties such as ``title``\ , ``uri``\ + , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :vartype routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] """ _validation = { @@ -3813,6 +4507,14 @@ def __init__( routes: Optional[List["GatewayApiRoute"]] = None, **kwargs ): + """ + :keyword app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route + defines ``uri``. + :paramtype app_resource_id: str + :keyword routes: Array of API routes, each route contains properties such as ``title``\ , + ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :paramtype routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] + """ super(GatewayRouteConfigProperties, self).__init__(**kwargs) self.provisioning_state = None self.app_resource_id = app_resource_id @@ -3832,8 +4534,8 @@ class GatewayRouteConfigResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: API route config of the Spring Cloud Gateway. - :type properties: + :ivar properties: API route config of the Spring Cloud Gateway. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigProperties """ @@ -3858,6 +4560,11 @@ def __init__( properties: Optional["GatewayRouteConfigProperties"] = None, **kwargs ): + """ + :keyword properties: API route config of the Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigProperties + """ super(GatewayRouteConfigResource, self).__init__(**kwargs) self.properties = properties @@ -3865,12 +4572,12 @@ def __init__( class GatewayRouteConfigResourceCollection(msrest.serialization.Model): """Object that includes an array of Spring Cloud Gateway route config resources and a possible link for next set. - :param value: Collection of Spring Cloud Gateway route config resources. - :type value: + :ivar value: Collection of Spring Cloud Gateway route config resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -3885,6 +4592,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Spring Cloud Gateway route config resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(GatewayRouteConfigResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3895,28 +4610,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the repository. - :type name: str - :param pattern: Collection of pattern of the repository. - :type pattern: list[str] - :param uri: Required. URI of the repository. - :type uri: str - :param label: Label of the repository. - :type label: str - :param search_paths: Searching path of the repository. - :type search_paths: list[str] - :param username: Username of git repository basic auth. - :type username: str - :param password: Password of git repository basic auth. - :type password: str - :param host_key: Public sshKey of git repository. - :type host_key: str - :param host_key_algorithm: SshKey algorithm of git repository. - :type host_key_algorithm: str - :param private_key: Private sshKey algorithm of git repository. - :type private_key: str - :param strict_host_key_checking: Strict host key checking or not. - :type strict_host_key_checking: bool + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool """ _validation = { @@ -3954,6 +4669,30 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -3971,10 +4710,10 @@ def __init__( class ImageRegistryCredential(msrest.serialization.Model): """Credential of the image registry. - :param username: The username of the image registry credential. - :type username: str - :param password: The password of the image registry credential. - :type password: str + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str """ _attribute_map = { @@ -3989,6 +4728,12 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = username self.password = password @@ -4002,12 +4747,12 @@ class UploadedUserSourceInfo(UserSourceInfo): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the source uploaded.Constant filled by server. - :type type: str - :param version: Version of the source. - :type version: str - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str """ _validation = { @@ -4031,6 +4776,12 @@ def __init__( relative_path: Optional[str] = None, **kwargs ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + """ super(UploadedUserSourceInfo, self).__init__(version=version, **kwargs) self.type = 'UploadedUserSourceInfo' # type: str self.relative_path = relative_path @@ -4041,16 +4792,16 @@ class JarUploadedUserSourceInfo(UploadedUserSourceInfo): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the source uploaded.Constant filled by server. - :type type: str - :param version: Version of the source. - :type version: str - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param runtime_version: Runtime version of the Jar file. - :type runtime_version: str - :param jvm_options: Runtime version of the Jar file. - :type jvm_options: str + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar runtime_version: Runtime version of the Jar file. + :vartype runtime_version: str + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str """ _validation = { @@ -4074,7 +4825,17 @@ def __init__( jvm_options: Optional[str] = None, **kwargs ): - super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, jvm_options=jvm_options, **kwargs) + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword runtime_version: Runtime version of the Jar file. + :paramtype runtime_version: str + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + """ + super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) self.type = 'Jar' # type: str self.runtime_version = runtime_version self.jvm_options = jvm_options @@ -4087,8 +4848,8 @@ class KeyVaultCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of the certificate source.Constant filled by server. - :type type: str + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -4103,15 +4864,15 @@ class KeyVaultCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :param vault_uri: Required. The vault uri of user key vault. - :type vault_uri: str - :param key_vault_cert_name: Required. The certificate name of key vault. - :type key_vault_cert_name: str - :param cert_version: The certificate version of key vault. - :type cert_version: str - :param exclude_private_key: Optional. If set to true, it will not import private key from key + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str + :ivar exclude_private_key: Optional. If set to true, it will not import private key from key vault. - :type exclude_private_key: bool + :vartype exclude_private_key: bool """ _validation = { @@ -4151,6 +4912,17 @@ def __init__( exclude_private_key: Optional[bool] = False, **kwargs ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + :keyword exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :paramtype exclude_private_key: bool + """ super(KeyVaultCertificateProperties, self).__init__(**kwargs) self.type = 'KeyVaultCertificate' # type: str self.vault_uri = vault_uri @@ -4164,11 +4936,11 @@ class LoadedCertificate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param resource_id: Required. Resource Id of loaded certificate. - :type resource_id: str - :param load_trust_store: Indicate whether the certificate will be loaded into default trust + :ivar resource_id: Required. Resource Id of loaded certificate. + :vartype resource_id: str + :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. - :type load_trust_store: bool + :vartype load_trust_store: bool """ _validation = { @@ -4187,6 +4959,13 @@ def __init__( load_trust_store: Optional[bool] = False, **kwargs ): + """ + :keyword resource_id: Required. Resource Id of loaded certificate. + :paramtype resource_id: str + :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :paramtype load_trust_store: bool + """ super(LoadedCertificate, self).__init__(**kwargs) self.resource_id = resource_id self.load_trust_store = load_trust_store @@ -4197,8 +4976,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param url: Required. URL of the log file. - :type url: str + :ivar url: Required. URL of the log file. + :vartype url: str """ _validation = { @@ -4215,6 +4994,10 @@ def __init__( url: str, **kwargs ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -4222,12 +5005,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -4244,6 +5027,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -4253,13 +5044,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityType - :param principal_id: Principal Id. - :type principal_id: str - :param tenant_id: Tenant Id. - :type tenant_id: str + :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id. + :vartype principal_id: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str """ _attribute_map = { @@ -4276,6 +5067,15 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -4285,13 +5085,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :param name: Name of the dimension. - :type name: str - :param display_name: Localized friendly display name of the dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -4308,6 +5108,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -4317,31 +5126,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :param name: Name of the metric. - :type name: str - :param display_name: Localized friendly display name of the metric. - :type display_name: str - :param display_description: Localized friendly description of the metric. - :type display_description: str - :param unit: Unit that makes sense for the metric. - :type unit: str - :param category: Name of the metric category that the metric belongs to. A metric can only + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :type category: str - :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :type aggregation_type: str - :param supported_aggregation_types: Supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: Supported time grain types. - :type supported_time_grain_types: list[str] - :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :type fill_gap_with_zero: bool - :param dimensions: Dimensions of the metric. - :type dimensions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricDimension] - :param source_mdm_namespace: Name of the MDM namespace. Optional. - :type source_mdm_namespace: str + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str """ _attribute_map = { @@ -4374,6 +5183,33 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -4397,20 +5233,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingState - :param error: Error when apply Monitoring Setting changes. - :type error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error - :param trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :type trace_enabled: bool - :param app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :type app_insights_instrumentation_key: str - :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated + since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate + if monitoringSettings enabled or not. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :type app_insights_sampling_rate: float - :param app_insights_agent_versions: Indicates the versions of application insight agent. - :type app_insights_agent_versions: + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApplicationInsightsAgentVersions """ @@ -4438,6 +5274,23 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApplicationInsightsAgentVersions + """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -4460,8 +5313,8 @@ class MonitoringSettingResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the Monitoring Setting resource. - :type properties: + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingProperties """ @@ -4486,6 +5339,11 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingProperties + """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -4493,12 +5351,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :param name_available: Indicates whether the name is available. - :type name_available: bool - :param reason: Reason why the name is not available. - :type reason: str - :param message: Message why the name is not available. - :type message: str + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str """ _attribute_map = { @@ -4515,6 +5373,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -4526,10 +5392,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the resource to check name availability. - :type type: str - :param name: Required. Name to be checked. - :type name: str + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str """ _validation = { @@ -4549,6 +5415,12 @@ def __init__( name: str, **kwargs ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -4559,16 +5431,16 @@ class NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the source uploaded.Constant filled by server. - :type type: str - :param version: Version of the source. - :type version: str - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param net_core_main_entry_path: The path to the .NET executable relative to zip root. - :type net_core_main_entry_path: str - :param runtime_version: Runtime version of the .Net file. - :type runtime_version: str + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar runtime_version: Runtime version of the .Net file. + :vartype runtime_version: str """ _validation = { @@ -4592,6 +5464,16 @@ def __init__( runtime_version: Optional[str] = None, **kwargs ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword runtime_version: Runtime version of the .Net file. + :paramtype runtime_version: str + """ super(NetCoreZipUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) self.type = 'NetCoreZip' # type: str self.net_core_main_entry_path = net_core_main_entry_path @@ -4603,20 +5485,19 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :type service_runtime_subnet_id: str - :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :type app_subnet_id: str - :param service_cidr: Azure Spring Cloud service reserved CIDR. - :type service_cidr: str - :param service_runtime_network_resource_group: Name of the resource group containing network + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Cloud Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Cloud service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :type service_runtime_network_resource_group: str - :param app_network_resource_group: Name of the resource group containing network resources of + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :type app_network_resource_group: str + :vartype app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfileOutboundIPs @@ -4650,6 +5531,22 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Cloud service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Cloud Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources of + Azure Spring Cloud Apps. + :paramtype app_network_resource_group: str + """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -4681,6 +5578,8 @@ def __init__( self, **kwargs ): + """ + """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -4688,22 +5587,32 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - :param name: Name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: Display of the operation. - :type display: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDisplay - :param origin: Origin of the operation. - :type origin: str - :param properties: Properties of the operation. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :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.appplatform.v2022_01_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationProperties """ + _validation = { + 'action_type': {'readonly': True}, + } + _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -4718,10 +5627,23 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :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.appplatform.v2022_01_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationProperties + """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display + self.action_type = None self.origin = origin self.properties = properties @@ -4729,14 +5651,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource of the operation. - :type resource: str - :param operation: Localized friendly name for the operation. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :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 = { @@ -4755,6 +5677,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -4765,8 +5697,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :param service_specification: Service specifications of the operation. - :type service_specification: + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceSpecification """ @@ -4780,6 +5712,11 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -4789,12 +5726,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param size_in_gb: Size of the persistent disk in GB. - :type size_in_gb: int + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :param mount_path: Mount path of the persistent disk. - :type mount_path: str + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str """ _validation = { @@ -4815,6 +5752,12 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -4826,9 +5769,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key_type: Required. Type of the test key. Possible values include: "Primary", + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :type key_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeyType + :vartype key_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeyType """ _validation = { @@ -4845,6 +5788,11 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeyType + """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -4887,6 +5835,8 @@ def __init__( self, **kwargs ): + """ + """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -4898,12 +5848,12 @@ def __init__( class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :type cpu: str - :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :type memory: str + :vartype cpu: str + :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, + 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :vartype memory: str """ _attribute_map = { @@ -4918,6 +5868,14 @@ def __init__( memory: Optional[str] = None, **kwargs ): + """ + :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 + for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :paramtype cpu: str + :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :paramtype memory: str + """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -4926,23 +5884,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :param resource_type: Gets the type of resource the SKU applies to. - :type resource_type: str - :param name: Gets the name of SKU. - :type name: str - :param tier: Gets the tier of SKU. - :type tier: str - :param capacity: Gets the capacity of SKU. - :type capacity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuCapacity - :param locations: Gets the set of locations that the SKU is available. - :type locations: list[str] - :param location_info: Gets a list of locations and availability zones in those locations where + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :type location_info: + :vartype location_info: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuLocationInfo] - :param restrictions: Gets the restrictions because of which SKU cannot be used. This is + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :type restrictions: + :vartype restrictions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictions] """ @@ -4968,6 +5926,26 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictions] + """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -4981,10 +5959,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :param name: Gets an invariant to describe the feature. - :type name: str - :param value: Gets an invariant if the feature is measured by quantity. - :type value: str + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str """ _attribute_map = { @@ -4999,6 +5977,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -5007,11 +5991,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :param value: Collection of resource SKU. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -5026,6 +6010,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5034,12 +6025,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :param location: Gets location of the SKU. - :type location: str - :param zones: Gets list of availability zones where the SKU is supported. - :type zones: list[str] - :param zone_details: Gets details of capabilities available to a SKU in specific zones. - :type zone_details: + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuZoneDetails] """ @@ -5057,6 +6048,15 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuZoneDetails] + """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -5066,10 +6066,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :param locations: Gets locations where the SKU is restricted. - :type locations: list[str] - :param zones: Gets list of availability zones where the SKU is restricted. - :type zones: list[str] + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] """ _attribute_map = { @@ -5084,6 +6084,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -5092,21 +6098,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :type type: str or + :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsType - :param values: Gets the value of restrictions. If the restriction type is set to + :ivar values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :type values: list[str] - :param restriction_info: Gets the information about the restriction where the SKU cannot be + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be used. - :type restriction_info: + :vartype restriction_info: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionInfo - :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :type reason_code: str or + :vartype reason_code: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -5126,6 +6132,24 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsReasonCode + """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -5136,12 +6160,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :param name: Gets the set of zones that the SKU is available in with the + :ivar name: Gets the set of zones that the SKU is available in with the specified capabilities. - :type name: list[str] - :param capabilities: Gets a list of capabilities that are available for the SKU in the + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :type capabilities: + :vartype capabilities: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCapabilities] """ @@ -5157,6 +6181,15 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCapabilities] + """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -5165,10 +6198,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :param relative_path: Source relative path. - :type relative_path: str - :param upload_url: Upload URL. - :type upload_url: str + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str """ _attribute_map = { @@ -5183,6 +6216,12 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -5213,6 +6252,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServiceRegistryInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -5251,6 +6292,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServiceRegistryProperties, self).__init__(**kwargs) self.provisioning_state = None self.resource_requests = None @@ -5270,8 +6313,9 @@ class ServiceRegistryResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Service Registry properties payload. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties + :ivar properties: Service Registry properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties """ _validation = { @@ -5295,6 +6339,11 @@ def __init__( properties: Optional["ServiceRegistryProperties"] = None, **kwargs ): + """ + :keyword properties: Service Registry properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties + """ super(ServiceRegistryResource, self).__init__(**kwargs) self.properties = properties @@ -5302,11 +6351,12 @@ def __init__( class ServiceRegistryResourceCollection(msrest.serialization.Model): """Object that includes an array of Service Registry resources and a possible link for next set. - :param value: Collection of Service Registry resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Service Registry resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -5321,6 +6371,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service Registry resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceRegistryResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5355,6 +6413,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServiceRegistryResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -5374,11 +6434,11 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] """ _validation = { @@ -5404,6 +6464,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -5422,15 +6489,16 @@ class ServiceResource(TrackedResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param location: The GEO location of the resource. - :type location: str - :param tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :type tags: dict[str, str] - :param properties: Properties of the Service resource. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ClusterResourceProperties - :param sku: Sku of the Service resource. - :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -5460,6 +6528,18 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -5468,11 +6548,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :param value: Collection of Service resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -5487,6 +6567,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5495,11 +6582,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LogSpecification] - :param metric_specifications: Specifications of the Metrics for Azure Monitoring. - :type metric_specifications: + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricSpecification] """ @@ -5515,6 +6602,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -5523,12 +6618,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :param name: Name of the Sku. - :type name: str - :param tier: Tier of the Sku. - :type tier: str - :param capacity: Current capacity of the target resource. - :type capacity: int + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int """ _attribute_map = { @@ -5545,6 +6640,14 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -5556,15 +6659,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param minimum: Required. Gets or sets the minimum. - :type minimum: int - :param maximum: Gets or sets the maximum. - :type maximum: int - :param default: Gets or sets the default. - :type default: int - :param scale_type: Gets or sets the type of the scale. Possible values include: "None", + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :type scale_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuScaleType + :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuScaleType """ _validation = { @@ -5587,6 +6690,17 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuScaleType + """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -5599,18 +6713,18 @@ class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the source uploaded.Constant filled by server. - :type type: str - :param version: Version of the source. - :type version: str - :param relative_path: Relative path of the storage which stores the source. - :type relative_path: str - :param artifact_selector: Selector for the artifact to be used for the deployment for + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :type artifact_selector: str - :param runtime_version: Runtime version of the source file. - :type runtime_version: str + :vartype artifact_selector: str + :ivar runtime_version: Runtime version of the source file. + :vartype runtime_version: str """ _validation = { @@ -5634,6 +6748,18 @@ def __init__( runtime_version: Optional[str] = None, **kwargs ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + :keyword runtime_version: Runtime version of the source file. + :paramtype runtime_version: str + """ super(SourceUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) self.type = 'Source' # type: str self.artifact_selector = artifact_selector @@ -5643,15 +6769,15 @@ def __init__( class SsoProperties(msrest.serialization.Model): """Single sign-on related configuration. - :param scope: It defines the specific actions applications can be allowed to do on a user's + :ivar scope: It defines the specific actions applications can be allowed to do on a user's behalf. - :type scope: list[str] - :param client_id: The public identifier for the application. - :type client_id: str - :param client_secret: The secret known only to the application and the authorization server. - :type client_secret: str - :param issuer_uri: The URI of Issuer Identifier. - :type issuer_uri: str + :vartype scope: list[str] + :ivar client_id: The public identifier for the application. + :vartype client_id: str + :ivar client_secret: The secret known only to the application and the authorization server. + :vartype client_secret: str + :ivar issuer_uri: The URI of Issuer Identifier. + :vartype issuer_uri: str """ _attribute_map = { @@ -5670,6 +6796,17 @@ def __init__( issuer_uri: Optional[str] = None, **kwargs ): + """ + :keyword scope: It defines the specific actions applications can be allowed to do on a user's + behalf. + :paramtype scope: list[str] + :keyword client_id: The public identifier for the application. + :paramtype client_id: str + :keyword client_secret: The secret known only to the application and the authorization server. + :paramtype client_secret: str + :keyword issuer_uri: The URI of Issuer Identifier. + :paramtype issuer_uri: str + """ super(SsoProperties, self).__init__(**kwargs) self.scope = scope self.client_id = client_id @@ -5680,10 +6817,10 @@ def __init__( class StackProperties(msrest.serialization.Model): """KPack ClusterStack properties payload. - :param id: Id of the ClusterStack. - :type id: str - :param version: Version of the ClusterStack. - :type version: str + :ivar id: Id of the ClusterStack. + :vartype id: str + :ivar version: Version of the ClusterStack. + :vartype version: str """ _attribute_map = { @@ -5698,6 +6835,12 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword id: Id of the ClusterStack. + :paramtype id: str + :keyword version: Version of the ClusterStack. + :paramtype version: str + """ super(StackProperties, self).__init__(**kwargs) self.id = id self.version = version @@ -5711,8 +6854,9 @@ class StorageProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_type: Required. The type of the storage.Constant filled by server. - :type storage_type: str + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageType """ _validation = { @@ -5731,6 +6875,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageProperties, self).__init__(**kwargs) self.storage_type = None # type: Optional[str] @@ -5740,12 +6886,13 @@ class StorageAccount(StorageProperties): All required parameters must be populated in order to send to Azure. - :param storage_type: Required. The type of the storage.Constant filled by server. - :type storage_type: str - :param account_name: Required. The account name of the Azure Storage Account. - :type account_name: str - :param account_key: Required. The account key of the Azure Storage Account. - :type account_key: str + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageType + :ivar account_name: Required. The account name of the Azure Storage Account. + :vartype account_name: str + :ivar account_key: Required. The account key of the Azure Storage Account. + :vartype account_key: str """ _validation = { @@ -5767,6 +6914,12 @@ def __init__( account_key: str, **kwargs ): + """ + :keyword account_name: Required. The account name of the Azure Storage Account. + :paramtype account_name: str + :keyword account_key: Required. The account key of the Azure Storage Account. + :paramtype account_key: str + """ super(StorageAccount, self).__init__(**kwargs) self.storage_type = 'StorageAccount' # type: str self.account_name = account_name @@ -5786,8 +6939,8 @@ class StorageResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Properties of the storage resource payload. - :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties """ _validation = { @@ -5811,6 +6964,10 @@ def __init__( properties: Optional["StorageProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties + """ super(StorageResource, self).__init__(**kwargs) self.properties = properties @@ -5818,10 +6975,10 @@ def __init__( class StorageResourceCollection(msrest.serialization.Model): """Collection compose of storage resources list and a possible link for next page. - :param value: The storage resources list. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :param next_link: The link to next page of storage list. - :type next_link: str + :ivar value: The storage resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str """ _attribute_map = { @@ -5836,6 +6993,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The storage resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ super(StorageResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5854,8 +7017,8 @@ class SupportedBuildpackResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Supported buildpack resource properties. - :type properties: + :ivar properties: Supported buildpack resource properties. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResourceProperties """ @@ -5880,6 +7043,11 @@ def __init__( properties: Optional["SupportedBuildpackResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Supported buildpack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResourceProperties + """ super(SupportedBuildpackResource, self).__init__(**kwargs) self.properties = properties @@ -5887,8 +7055,8 @@ def __init__( class SupportedBuildpackResourceProperties(msrest.serialization.Model): """Supported buildpack resource properties. - :param buildpack_id: The id of supported buildpack. - :type buildpack_id: str + :ivar buildpack_id: The id of supported buildpack. + :vartype buildpack_id: str """ _attribute_map = { @@ -5901,6 +7069,10 @@ def __init__( buildpack_id: Optional[str] = None, **kwargs ): + """ + :keyword buildpack_id: The id of supported buildpack. + :paramtype buildpack_id: str + """ super(SupportedBuildpackResourceProperties, self).__init__(**kwargs) self.buildpack_id = buildpack_id @@ -5908,12 +7080,12 @@ def __init__( class SupportedBuildpacksCollection(msrest.serialization.Model): """Object that includes an array of supported buildpacks resources and a possible link for next set. - :param value: Collection of supported buildpacks resources. - :type value: + :ivar value: Collection of supported buildpacks resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -5928,6 +7100,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of supported buildpacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(SupportedBuildpacksCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -5936,15 +7116,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :param value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "Java_17", "NetCore_31". - :type value: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimeValue - :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "Java_17", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :type platform: str or + :vartype platform: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimePlatform - :param version: The detailed version (major.minor) of the platform. - :type version: str + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str """ _attribute_map = { @@ -5961,6 +7141,18 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "Java_17", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -5980,8 +7172,8 @@ class SupportedStackResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :param properties: Supported stack resource properties. - :type properties: + :ivar properties: Supported stack resource properties. + :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResourceProperties """ @@ -6006,6 +7198,11 @@ def __init__( properties: Optional["SupportedStackResourceProperties"] = None, **kwargs ): + """ + :keyword properties: Supported stack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResourceProperties + """ super(SupportedStackResource, self).__init__(**kwargs) self.properties = properties @@ -6013,10 +7210,10 @@ def __init__( class SupportedStackResourceProperties(msrest.serialization.Model): """Supported stack resource properties. - :param stack_id: The id of supported stack. - :type stack_id: str - :param version: The version of supported stack. - :type version: str + :ivar stack_id: The id of supported stack. + :vartype stack_id: str + :ivar version: The version of supported stack. + :vartype version: str """ _attribute_map = { @@ -6031,6 +7228,12 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword stack_id: The id of supported stack. + :paramtype stack_id: str + :keyword version: The version of supported stack. + :paramtype version: str + """ super(SupportedStackResourceProperties, self).__init__(**kwargs) self.stack_id = stack_id self.version = version @@ -6039,11 +7242,11 @@ def __init__( class SupportedStacksCollection(msrest.serialization.Model): """Object that includes an array of supported stacks resources and a possible link for next set. - :param value: Collection of supported stacks resources. - :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] - :param next_link: URL client should use to fetch the next page (per server side paging). + :ivar value: Collection of supported stacks resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :type next_link: str + :vartype next_link: str """ _attribute_map = { @@ -6058,6 +7261,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Collection of supported stacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ super(SupportedStacksCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6066,21 +7277,22 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.LastModifiedByType - :param last_modified_at: The timestamp of resource modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -6103,6 +7315,24 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2022_01_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -6115,10 +7345,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :param size_in_gb: Size of the temporary disk in GB. - :type size_in_gb: int - :param mount_path: Mount path of the temporary disk. - :type mount_path: str + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str """ _validation = { @@ -6137,6 +7367,12 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -6145,16 +7381,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :param primary_key: Primary key. - :type primary_key: str - :param secondary_key: Secondary key. - :type secondary_key: str - :param primary_test_endpoint: Primary test endpoint. - :type primary_test_endpoint: str - :param secondary_test_endpoint: Secondary test endpoint. - :type secondary_test_endpoint: str - :param enabled: Indicates whether the test endpoint feature enabled or not. - :type enabled: bool + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -6175,6 +7411,18 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -6186,8 +7434,8 @@ def __init__( class TriggeredBuildResult(msrest.serialization.Model): """The build result triggered by a build. - :param id: The unique build id of this build result. - :type id: str + :ivar id: The unique build id of this build result. + :vartype id: str """ _attribute_map = { @@ -6200,6 +7448,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The unique build id of this build result. + :paramtype id: str + """ super(TriggeredBuildResult, self).__init__(**kwargs) self.id = id @@ -6207,10 +7459,10 @@ def __init__( class ValidationMessages(msrest.serialization.Model): """Validate messages of the configuration service git repositories. - :param name: The name of the configuration service git repository. - :type name: str - :param messages: Detailed validation messages. - :type messages: list[str] + :ivar name: The name of the configuration service git repository. + :vartype name: str + :ivar messages: Detailed validation messages. + :vartype messages: list[str] """ _attribute_map = { @@ -6225,6 +7477,12 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): + """ + :keyword name: The name of the configuration service git repository. + :paramtype name: str + :keyword messages: Detailed validation messages. + :paramtype messages: list[str] + """ super(ValidationMessages, self).__init__(**kwargs) self.name = name self.messages = messages diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py index b6ed0a08705..6ababcc56e8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,193 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ApiPortalCustomDomainsOperations(object): """ApiPortalCustomDomainsOperations operations. @@ -47,15 +216,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApiPortalCustomDomainResource" + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": """Get the API portal custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +246,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +279,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - domain_name, # type: str - api_portal_custom_domain_resource, # type: "_models.ApiPortalCustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApiPortalCustomDomainResource" + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -175,18 +338,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - domain_name, # type: str - api_portal_custom_domain_resource, # type: "_models.ApiPortalCustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApiPortalCustomDomainResource"] + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.ApiPortalCustomDomainResource"]: """Create or update the API portal custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -200,17 +365,24 @@ def begin_create_or_update( :type domain_name: str :param api_portal_custom_domain_resource: The API portal custom domain for the create or update operation. - :type api_portal_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( @@ -225,29 +397,22 @@ def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -257,48 +422,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -308,17 +469,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the API portal custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -332,14 +494,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -353,26 +518,18 @@ def begin_delete( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -382,18 +539,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApiPortalCustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> Iterable["_models.ApiPortalCustomDomainResourceCollection"]: """Handle requests to list all API portal custom domains. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -404,46 +561,50 @@ def list( :param api_portal_name: The name of API portal. :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiPortalCustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -452,7 +613,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -461,7 +626,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py index ecc9e59c421..4b3996956aa 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,231 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ApiPortalsOperations(object): """ApiPortalsOperations operations. @@ -47,14 +254,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApiPortalResource" + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> "_models.ApiPortalResource": """Get the API portal and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +281,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +313,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - api_portal_resource, # type: "_models.ApiPortalResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApiPortalResource" + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> "_models.ApiPortalResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(api_portal_resource, 'ApiPortalResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,17 +370,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - api_portal_resource, # type: "_models.ApiPortalResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApiPortalResource"] + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> LROPoller["_models.ApiPortalResource"]: """Create the default API portal or update the existing API portal. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,14 +396,20 @@ def begin_create_or_update( :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApiPortalResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( @@ -214,28 +423,22 @@ def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,46 +448,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -294,16 +493,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the default API portal. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -315,14 +515,17 @@ def begin_delete( :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -335,25 +538,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,17 +559,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApiPortalResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ApiPortalResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -382,45 +578,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] + :return: An iterator like instance of either ApiPortalResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApiPortalResourceCollection', pipeline_response) + deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,7 +628,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,20 +641,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + @distributed_trace def validate_domain( self, - resource_group_name, # type: str - service_name, # type: str - api_portal_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": """Check the domains are valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -462,7 +666,8 @@ def validate_domain( :param api_portal_name: The name of API portal. :type api_portal_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -473,34 +678,30 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,4 +714,6 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py index cf8312c0d7f..250f8853971 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,365 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_active_deployments_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class AppsOperations(object): """AppsOperations operations. @@ -47,15 +388,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - sync_status=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -65,7 +406,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,31 +418,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if sync_status is not None: - query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,50 +451,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -177,17 +511,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -201,14 +537,20 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -222,28 +564,22 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -253,46 +589,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,16 +634,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -323,14 +656,17 @@ def begin_delete( :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -343,25 +679,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -371,52 +700,47 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(app_resource, 'AppResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -433,17 +757,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - app_resource, # type: "_models.AppResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -457,14 +783,20 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -478,28 +810,22 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -509,17 +835,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AppResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.AppResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -528,45 +854,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AppResourceCollection', pipeline_response) + deserialized = self._deserialize("AppResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -575,7 +904,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -584,19 +917,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + @distributed_trace def get_resource_upload_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -616,29 +950,26 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -651,50 +982,47 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + def _set_active_deployments_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - active_deployment_collection, # type: "_models.ActiveDeploymentCollection" - **kwargs # type: Any - ): - # type: (...) -> "_models.AppResource" + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> "_models.AppResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._set_active_deployments_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._set_active_deployments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -711,17 +1039,19 @@ def _set_active_deployments_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + + @distributed_trace def begin_set_active_deployments( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - active_deployment_collection, # type: "_models.ActiveDeploymentCollection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AppResource"] + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: """Set existing Deployment under the app as active. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -732,17 +1062,24 @@ def begin_set_active_deployments( :param app_name: The name of the App resource. :type app_name: str :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -756,28 +1093,22 @@ def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -787,19 +1118,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + @distributed_trace def validate_domain( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -810,7 +1141,8 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -821,34 +1153,30 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -861,4 +1189,6 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py index 391d0e2c7f9..58353810710 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BindingsOperations(object): """BindingsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BindingResource" + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(binding_resource, 'BindingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - binding_name, # type: str - binding_resource, # type: "_models.BindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BindingResource"] + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BindingResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.BindingResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py index cf37e99c46c..f08381a1a61 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,153 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class BuildServiceAgentPoolOperations(object): """BuildServiceAgentPoolOperations operations. @@ -47,14 +176,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"] + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"]: """List build service agent pool. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -65,46 +194,50 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildServiceAgentPoolResourceCollection', pipeline_response) + deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,7 +246,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -122,20 +259,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - agent_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildServiceAgentPoolResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": """Get build service agent pool. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -157,30 +295,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -193,52 +328,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - agent_pool_name, # type: str - pool_size, # type: "_models.BuildServiceAgentPoolSizeProperties" - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildServiceAgentPoolResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(pool_size, 'BuildServiceAgentPoolSizeProperties') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -255,18 +387,20 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - agent_pool_name, # type: str - pool_size, # type: "_models.BuildServiceAgentPoolSizeProperties" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BuildServiceAgentPoolResource"] + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> LROPoller["_models.BuildServiceAgentPoolResource"]: """Create or update build service agent pool. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -278,18 +412,25 @@ def begin_update_put( :type build_service_name: str :param agent_pool_name: The name of the build service agent pool resource. :type agent_pool_name: str - :param pool_size: Parameters for the update operation. - :type pool_size: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( @@ -303,30 +444,23 @@ def begin_update_put( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - pool_size=pool_size, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -336,6 +470,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py index ddce0e2031d..372456dce93 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,193 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BuildServiceBuilderOperations(object): """BuildServiceBuilderOperations operations. @@ -47,15 +216,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuilderResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> "_models.BuilderResource": """Get a KPack builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +246,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +279,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - builder_resource, # type: "_models.BuilderResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BuilderResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> "_models.BuilderResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(builder_resource, 'BuilderResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -175,18 +338,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - builder_resource, # type: "_models.BuilderResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BuilderResource"] + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> LROPoller["_models.BuilderResource"]: """Create or update a KPack builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -202,14 +367,20 @@ def begin_create_or_update( :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BuilderResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( @@ -224,29 +395,22 @@ def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuilderResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -256,48 +420,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -307,17 +467,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a KPack builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -331,14 +492,17 @@ def begin_delete( :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -352,26 +516,18 @@ def begin_delete( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -381,18 +537,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuilderResourceCollection"] + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuilderResourceCollection"]: """List KPack builders result. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -403,46 +559,50 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] + :return: An iterator like instance of either BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuilderResourceCollection', pipeline_response) + deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -451,7 +611,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -460,7 +624,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py index fec8413533c..30f21ac6634 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,543 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_build_services_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_service_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_builds_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_build_results_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_result_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_result_log_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_supported_buildpacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_supported_buildpack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_supported_stacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_supported_stack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BuildServiceOperations(object): """BuildServiceOperations operations. @@ -45,13 +566,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_build_services( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildServiceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceCollection"]: """List build services resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -60,45 +581,48 @@ def list_build_services( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_build_services.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildServiceCollection', pipeline_response) + deserialized = self._deserialize("BuildServiceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +631,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -116,19 +644,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + @distributed_trace def get_build_service( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildService" + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.BuildService": """Get a build service resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -148,29 +677,26 @@ def get_build_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_service.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_build_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -183,16 +709,18 @@ def get_build_service( return cls(pipeline_response, deserialized, {}) return deserialized - get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + + + @distributed_trace def list_builds( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildCollection"] + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildCollection"]: """List KPack builds. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -204,45 +732,48 @@ def list_builds( :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_builds.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildCollection', pipeline_response) + deserialized = self._deserialize("BuildCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -251,7 +782,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -260,20 +795,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + @distributed_trace def get_build( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - build_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Build" + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> "_models.Build": """Get a KPack build. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -295,30 +831,27 @@ def get_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.get_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -331,18 +864,20 @@ def get_build( return cls(pipeline_response, deserialized, {}) return deserialized - get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace def create_or_update_build( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - build_name, # type: str - build, # type: "_models.Build" - **kwargs # type: Any - ): - # type: (...) -> "_models.Build" + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: "_models.Build", + **kwargs: Any + ) -> "_models.Build": """Create or update a KPack build. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -366,35 +901,31 @@ def create_or_update_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update_build.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(build, 'Build') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -411,17 +942,19 @@ def create_or_update_build( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace def list_build_results( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - build_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildResultCollection"] + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildResultCollection"]: """List KPack build results. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -434,47 +967,52 @@ def list_build_results( :param build_name: The name of the build resource. :type build_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_build_results.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildResultCollection', pipeline_response) + deserialized = self._deserialize("BuildResultCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -483,7 +1021,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -492,21 +1034,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + @distributed_trace def get_build_result( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - build_name, # type: str - build_result_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildResult" + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResult": """Get a KPack build result. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -530,31 +1073,28 @@ def get_build_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -567,18 +1107,20 @@ def get_build_result( return cls(pipeline_response, deserialized, {}) return deserialized - get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + + + @distributed_trace def get_build_result_log( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - build_name, # type: str - build_result_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildResultLog" + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResultLog": """Get a KPack build result log download URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -602,31 +1144,28 @@ def get_build_result_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_build_result_log.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildName': self._serialize.url("build_name", build_name, 'str'), - 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -639,16 +1178,18 @@ def get_build_result_log( return cls(pipeline_response, deserialized, {}) return deserialized - get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + + + @distributed_trace def get_resource_upload_url( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ResourceUploadDefinition" + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": """Get an resource upload URL for build service, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -668,29 +1209,26 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_resource_upload_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -703,16 +1241,18 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace def list_supported_buildpacks( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SupportedBuildpacksCollection" + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpacksCollection": """Get all supported buildpacks. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -732,29 +1272,26 @@ def list_supported_buildpacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_supported_buildpacks.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_buildpacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -767,17 +1304,19 @@ def list_supported_buildpacks( return cls(pipeline_response, deserialized, {}) return deserialized - list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + + + @distributed_trace def get_supported_buildpack( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - buildpack_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SupportedBuildpackResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpackResource": """Get the supported buildpack resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -799,30 +1338,27 @@ def get_supported_buildpack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_supported_buildpack.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'buildpackName': self._serialize.url("buildpack_name", buildpack_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + api_version=api_version, + template_url=self.get_supported_buildpack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -835,16 +1371,18 @@ def get_supported_buildpack( return cls(pipeline_response, deserialized, {}) return deserialized - get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + + + @distributed_trace def list_supported_stacks( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SupportedStacksCollection" + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedStacksCollection": """Get all supported stacks. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -864,29 +1402,26 @@ def list_supported_stacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_supported_stacks.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_stacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -899,17 +1434,19 @@ def list_supported_stacks( return cls(pipeline_response, deserialized, {}) return deserialized - list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + + + @distributed_trace def get_supported_stack( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - stack_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SupportedStackResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any + ) -> "_models.SupportedStackResource": """Get the supported stack resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -931,30 +1468,27 @@ def get_supported_stack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_supported_stack.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'stackName': self._serialize.url("stack_name", stack_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + api_version=api_version, + template_url=self.get_supported_stack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -967,4 +1501,6 @@ def get_supported_stack( return cls(pipeline_response, deserialized, {}) return deserialized - get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore + + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py index d9facbd8c7d..64c9943c8b9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,201 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class BuildpackBindingOperations(object): """BuildpackBindingOperations operations. @@ -47,16 +224,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - buildpack_binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildpackBindingResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> "_models.BuildpackBindingResource": """Get a buildpack binding by name. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -80,31 +257,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,54 +291,51 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - buildpack_binding_name, # type: str - buildpack_binding, # type: "_models.BuildpackBindingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.BuildpackBindingResource" + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> "_models.BuildpackBindingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -181,19 +352,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - buildpack_binding_name, # type: str - buildpack_binding, # type: "_models.BuildpackBindingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BuildpackBindingResource"] + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> LROPoller["_models.BuildpackBindingResource"]: """Create or update a buildpack binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -208,17 +381,24 @@ def begin_create_or_update( :param buildpack_binding_name: The name of the Buildpack Binding Name. :type buildpack_binding_name: str :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :type buildpack_binding: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( @@ -234,30 +414,22 @@ def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -267,50 +439,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - buildpack_binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -320,18 +488,19 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - buildpack_binding_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Buildpack Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -347,14 +516,17 @@ def begin_delete( :type buildpack_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -369,27 +541,18 @@ def begin_delete( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -399,19 +562,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - build_service_name, # type: str - builder_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BuildpackBindingResourceCollection"] + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildpackBindingResourceCollection"]: """Handles requests to list all buildpack bindings in a builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -424,47 +587,52 @@ def list( :param builder_name: The name of the builder resource. :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), - 'builderName': self._serialize.url("builder_name", builder_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BuildpackBindingResourceCollection', pipeline_response) + deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -473,7 +641,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -482,7 +654,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py index 8479ce22015..f4548d0e160 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,185 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CertificatesOperations(object): """CertificatesOperations operations. @@ -47,14 +208,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +235,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +267,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CertificateResource" + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_resource, 'CertificateResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,17 +327,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - certificate_resource, # type: "_models.CertificateResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CertificateResource"] + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,17 +350,24 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource + :type certificate_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -217,28 +381,22 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,46 +406,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -297,16 +451,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - certificate_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,14 +473,17 @@ def begin_delete( :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,25 +496,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,17 +517,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CertificateResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateResourceCollection"]: """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -385,45 +536,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -432,7 +586,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +599,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py index ab72f2e1cef..b96c2738185 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,194 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -46,13 +217,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +241,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +272,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +327,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +347,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -203,27 +377,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +402,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerResource" + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +457,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - config_server_resource, # type: "_models.ConfigServerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerResource"] + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +477,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -334,27 +507,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,50 +532,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _validate_initial( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigServerSettingsValidateResult" + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -424,16 +587,18 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace def begin_validate( self, - resource_group_name, # type: str - service_name, # type: str - config_server_settings, # type: "_models.ConfigServerSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -442,17 +607,24 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings + :type config_server_settings: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,27 +637,22 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -495,6 +662,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py index 847de780d36..7eb2e2b4b01 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,231 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ConfigurationServicesOperations(object): """ConfigurationServicesOperations operations. @@ -47,14 +254,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - configuration_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigurationServiceResource" + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": """Get the Application Configuration Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +281,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +313,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - configuration_service_name, # type: str - configuration_service_resource, # type: "_models.ConfigurationServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigurationServiceResource" + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,17 +370,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - configuration_service_name, # type: str - configuration_service_resource, # type: "_models.ConfigurationServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigurationServiceResource"] + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceResource"]: """Create the default Application Configuration Service or update the existing Application Configuration Service. @@ -191,17 +394,24 @@ def begin_create_or_update( :param configuration_service_name: The name of Application Configuration Service. :type configuration_service_name: str :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( @@ -215,28 +425,22 @@ def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -246,46 +450,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - configuration_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -295,16 +495,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - configuration_service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disable the default Application Configuration Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -316,14 +517,17 @@ def begin_delete( :type configuration_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -336,25 +540,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,17 +561,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ConfigurationServiceResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ConfigurationServiceResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -383,45 +580,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ConfigurationServiceResourceCollection', pipeline_response) + deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,7 +630,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -439,53 +643,49 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore def _validate_initial( self, - resource_group_name, # type: str - service_name, # type: str - configuration_service_name, # type: str - settings, # type: "_models.ConfigurationServiceSettings" - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfigurationServiceSettingsValidateResult" + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> "_models.ConfigurationServiceSettingsValidateResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(settings, 'ConfigurationServiceSettings') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -502,17 +702,19 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + + + @distributed_trace def begin_validate( self, - resource_group_name, # type: str - service_name, # type: str - configuration_service_name, # type: str - settings, # type: "_models.ConfigurationServiceSettings" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"] + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"]: """Check if the Application Configuration Service settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -526,14 +728,20 @@ def begin_validate( :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( @@ -547,28 +755,22 @@ def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -578,6 +780,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py index 3308e48649a..9949e31c50a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,241 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -47,15 +264,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +294,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +327,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +389,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -205,14 +418,20 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -227,29 +446,22 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +471,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +518,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +543,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +567,18 @@ def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +588,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainResource" + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(domain_resource, 'CustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +647,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - domain_name, # type: str - domain_resource, # type: "_models.CustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CustomDomainResource"] + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -475,14 +676,20 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -497,29 +704,22 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,18 +729,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainResourceCollection"]: """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,46 +751,50 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -599,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -608,7 +816,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py index f70ebea5539..8a71e1e1f7f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,27 +6,591 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class DeploymentsOperations(object): +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_generate_heap_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_generate_thread_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_jfr_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class DeploymentsOperations(object): # pylint: disable=too-many-public-methods """DeploymentsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,15 +612,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +642,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +675,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -178,18 +737,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -202,17 +763,24 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -227,29 +795,22 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,48 +820,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -310,17 +867,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -334,14 +892,17 @@ def begin_delete( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -355,26 +916,18 @@ def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -384,54 +937,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DeploymentResource" + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(deployment_resource, 'DeploymentResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -448,18 +996,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - deployment_resource, # type: "_models.DeploymentResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DeploymentResource"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -472,17 +1022,24 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -497,29 +1054,22 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -529,19 +1079,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -551,51 +1101,55 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -604,7 +1158,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -613,19 +1171,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + @distributed_trace def list_for_cluster( self, - resource_group_name, # type: str - service_name, # type: str - version=None, # type: Optional[List[str]] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeploymentResourceCollection"] + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -633,50 +1192,53 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_for_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if version is not None: - query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -685,7 +1247,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -694,49 +1260,46 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -746,17 +1309,18 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - def begin_start( + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -770,14 +1334,17 @@ def begin_start( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,26 +1358,18 @@ def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -820,48 +1379,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _stop_initial( + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + def _stop_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -871,17 +1426,18 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + - def begin_stop( + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -895,14 +1451,17 @@ def begin_stop( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -916,26 +1475,18 @@ def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -945,48 +1496,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._restart_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -996,17 +1543,18 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - def begin_restart( + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1020,14 +1568,17 @@ def begin_restart( :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1041,26 +1592,18 @@ def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1070,19 +1613,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + @distributed_trace def get_log_file_url( self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.LogFileUrlResponse"] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1104,30 +1647,27 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_log_file_url.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1142,52 +1682,49 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - def _generate_heap_dump_initial( + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_heap_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1197,18 +1734,19 @@ def _generate_heap_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + - def begin_generate_heap_dump( + @distributed_trace + def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: """Generate Heap Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1221,17 +1759,22 @@ def begin_generate_heap_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1246,26 +1789,19 @@ def begin_generate_heap_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1275,54 +1811,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - def _generate_thread_dump_initial( + def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._generate_thread_dump_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1332,18 +1863,19 @@ def _generate_thread_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - def begin_generate_thread_dump( + + @distributed_trace + def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: """Generate Thread Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1356,17 +1888,22 @@ def begin_generate_thread_dump( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1381,26 +1918,19 @@ def begin_generate_thread_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1410,54 +1940,49 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _start_jfr_initial( + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + def _start_jfr_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._start_jfr_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1467,18 +1992,19 @@ def _start_jfr_initial( if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore - def begin_start_jfr( + + @distributed_trace + def begin_start_jfr( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - app_name, # type: str - deployment_name, # type: str - diagnostic_parameters, # type: "_models.DiagnosticParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: """Start JFR. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1491,17 +2017,22 @@ def begin_start_jfr( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1516,26 +2047,19 @@ def begin_start_jfr( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'appName': self._serialize.url("app_name", app_name, 'str'), - 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1545,6 +2069,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py index 1cfaff6e8f7..32a152a04a5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,193 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class GatewayCustomDomainsOperations(object): """GatewayCustomDomainsOperations operations. @@ -47,15 +216,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GatewayCustomDomainResource" + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": """Get the Spring Cloud Gateway custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +246,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +279,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - domain_name, # type: str - gateway_custom_domain_resource, # type: "_models.GatewayCustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.GatewayCustomDomainResource" + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -175,18 +338,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - domain_name, # type: str - gateway_custom_domain_resource, # type: "_models.GatewayCustomDomainResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GatewayCustomDomainResource"] + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayCustomDomainResource"]: """Create or update the Spring Cloud Gateway custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -200,17 +365,24 @@ def begin_create_or_update( :type domain_name: str :param gateway_custom_domain_resource: The gateway custom domain resource for the create or update operation. - :type gateway_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( @@ -225,29 +397,22 @@ def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -257,48 +422,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -308,17 +469,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - domain_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the Spring Cloud Gateway custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -332,14 +494,17 @@ def begin_delete( :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -353,26 +518,18 @@ def begin_delete( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'domainName': self._serialize.url("domain_name", domain_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -382,18 +539,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GatewayCustomDomainResourceCollection"] + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayCustomDomainResourceCollection"]: """Handle requests to list all Spring Cloud Gateway custom domains. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -404,46 +561,50 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayCustomDomainResourceCollection', pipeline_response) + deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -452,7 +613,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -461,7 +626,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py index bc96fbc6552..ea36d09af01 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,193 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class GatewayRouteConfigsOperations(object): """GatewayRouteConfigsOperations operations. @@ -47,15 +216,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - route_config_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GatewayRouteConfigResource" + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": """Get the Spring Cloud Gateway route configs. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -77,30 +246,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,52 +279,49 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - route_config_name, # type: str - gateway_route_config_resource, # type: "_models.GatewayRouteConfigResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.GatewayRouteConfigResource" + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -175,18 +338,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - route_config_name, # type: str - gateway_route_config_resource, # type: "_models.GatewayRouteConfigResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GatewayRouteConfigResource"] + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayRouteConfigResource"]: """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud Gateway route configs. @@ -201,17 +366,24 @@ def begin_create_or_update( :type route_config_name: str :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or update operation. - :type gateway_route_config_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( @@ -226,29 +398,22 @@ def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -258,48 +423,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - route_config_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -309,17 +470,18 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - route_config_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the Spring Cloud Gateway route config. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -333,14 +495,17 @@ def begin_delete( :type route_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -354,26 +519,18 @@ def begin_delete( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -383,18 +540,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GatewayRouteConfigResourceCollection"] + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayRouteConfigResourceCollection"]: """Handle requests to list all Spring Cloud Gateway route configs. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -405,46 +562,50 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayRouteConfigResourceCollection', pipeline_response) + deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -453,7 +614,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -462,7 +627,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py index 194061d1061..0598ab10638 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,231 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class GatewaysOperations(object): """GatewaysOperations operations. @@ -47,14 +254,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GatewayResource" + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> "_models.GatewayResource": """Get the Spring Cloud Gateway and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +281,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +313,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - gateway_resource, # type: "_models.GatewayResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.GatewayResource" + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> "_models.GatewayResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(gateway_resource, 'GatewayResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_resource, 'GatewayResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,17 +370,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - gateway_resource, # type: "_models.GatewayResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.GatewayResource"] + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayResource"]: """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -193,14 +396,20 @@ def begin_create_or_update( :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( @@ -214,28 +423,22 @@ def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('GatewayResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,46 +448,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -294,16 +493,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disable the default Spring Cloud Gateway. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -315,14 +515,17 @@ def begin_delete( :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -335,25 +538,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -363,17 +559,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GatewayResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -382,45 +578,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] + :return: An iterator like instance of either GatewayResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GatewayResourceCollection', pipeline_response) + deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -429,7 +628,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,20 +641,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + @distributed_trace def validate_domain( self, - resource_group_name, # type: str - service_name, # type: str - gateway_name, # type: str - validate_payload, # type: "_models.CustomDomainValidatePayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.CustomDomainValidateResult" + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": """Check the domains are valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -462,7 +666,8 @@ def validate_domain( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -473,34 +678,30 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_domain.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,4 +714,6 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py index e6ff2086618..77549aec608 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,150 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -46,13 +173,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -70,28 +197,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,48 +228,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + def _update_put_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_put_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -162,16 +283,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_put( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -180,17 +303,24 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -203,27 +333,22 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -233,50 +358,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore def _update_patch_initial( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.MonitoringSettingResource" + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_patch_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,16 +413,18 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace def begin_update_patch( self, - resource_group_name, # type: str - service_name, # type: str - monitoring_setting_resource, # type: "_models.MonitoringSettingResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MonitoringSettingResource"] + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -311,17 +433,24 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -334,27 +463,22 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -364,6 +488,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py index 9056b4dc128..b2d1f7e9bf4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,47 +73,49 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AvailableOperations"] + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AvailableOperations', pipeline_response) + deserialized = self._deserialize("AvailableOperations", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +137,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py index 70077593f37..b658b519029 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,49 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -44,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_runtime_versions( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AvailableRuntimeVersions" + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,22 +89,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_runtime_versions.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,4 +117,6 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py index 7bd9b2ab829..3d6c06c0bb9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,176 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ServiceRegistriesOperations(object): """ServiceRegistriesOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - service_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceRegistryResource" + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": """Get the Service Registry and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +226,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,44 +258,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - service_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceRegistryResource" + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.put(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,16 +310,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - service_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceRegistryResource"] + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller["_models.ServiceRegistryResource"]: """Create the default Service Registry or update the existing Service Registry. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -184,14 +333,19 @@ def begin_create_or_update( :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( @@ -204,28 +358,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,46 +382,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - service_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -284,16 +427,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - service_registry_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disable the default Service Registry. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -305,14 +449,17 @@ def begin_delete( :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -325,25 +472,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -353,17 +493,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceRegistryResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceRegistryResourceCollection"]: """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -372,45 +512,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceRegistryResourceCollection', pipeline_response) + deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -419,7 +562,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -428,7 +575,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py index f85033954bd..774c6ec8e3e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,519 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -47,13 +542,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -71,28 +566,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,48 +597,45 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,16 +655,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -187,14 +678,20 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -207,27 +704,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -237,44 +729,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -284,15 +772,16 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -302,14 +791,17 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -321,24 +813,18 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -348,50 +834,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -408,16 +889,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - service_name, # type: str - resource, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -429,14 +912,20 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -449,27 +938,22 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -479,17 +963,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace def list_test_keys( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -507,28 +991,25 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_test_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -541,16 +1022,18 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace def regenerate_test_key( self, - resource_group_name, # type: str - service_name, # type: str - regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -559,7 +1042,8 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys @@ -570,33 +1054,29 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate_test_key.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -609,15 +1089,17 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - def disable_test_endpoint( + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -635,28 +1117,25 @@ def disable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.disable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -666,15 +1145,16 @@ def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + @distributed_trace def enable_test_endpoint( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TestKeys" + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -692,28 +1172,25 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.enable_test_endpoint.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -726,42 +1203,40 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - def _stop_initial( + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + def _stop_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -771,15 +1246,16 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - def begin_stop( + + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -789,14 +1265,17 @@ def begin_stop( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -808,24 +1287,18 @@ def begin_stop( raw_result = self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -835,44 +1308,40 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -882,15 +1351,16 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + - def begin_start( + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Start a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -900,14 +1370,17 @@ def begin_start( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -919,24 +1392,18 @@ def begin_start( raw_result = self._start_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -946,23 +1413,24 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + @distributed_trace def check_name_availability( self, - location, # type: str - availability_parameters, # type: "_models.NameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailability" + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters + :type availability_parameters: + ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability @@ -973,32 +1441,28 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1011,53 +1475,55 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1066,7 +1532,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1075,17 +1545,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1093,43 +1564,44 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1138,7 +1610,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1147,7 +1623,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py index 924797dd16c..eb209b9ed5d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,56 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class SkusOperations(object): """SkusOperations operations. @@ -45,51 +79,52 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceSkuCollection"] + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,7 +133,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +146,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py index df22cb48b2c..8c38ca3d71a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,185 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class StoragesOperations(object): """StoragesOperations operations. @@ -47,14 +208,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageResource" + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> "_models.StorageResource": """Get the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -74,29 +235,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,50 +267,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - storage_resource, # type: "_models.StorageResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.StorageResource" + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> "_models.StorageResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(storage_resource, 'StorageResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,17 +327,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - storage_resource, # type: "_models.StorageResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.StorageResource"] + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> LROPoller["_models.StorageResource"]: """Create or update storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -196,14 +353,20 @@ def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either StorageResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -217,28 +380,22 @@ def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -248,46 +405,42 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -297,16 +450,17 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - service_name, # type: str - storage_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -318,14 +472,17 @@ def begin_delete( :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,25 +495,18 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - 'storageName': self._serialize.url("storage_name", storage_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -366,17 +516,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StorageResourceCollection"] + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageResourceCollection"]: """List all the storages of one Azure Spring Cloud instance. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -385,45 +535,48 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('StorageResourceCollection', pipeline_response) + deserialized = self._deserialize("StorageResourceCollection", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -432,7 +585,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +598,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py index f0b76b080b1..a02c226fdda 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import AppPlatformManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class AppPlatformManagementClient: +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -91,8 +92,11 @@ class AppPlatformManagementClient: :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -138,7 +142,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py index e5024e5cd94..20a46c65a9f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-03-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py index 2b76234971e..41d1acdf305 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import AppPlatformManagementClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient: +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -91,8 +92,11 @@ class AppPlatformManagementClient: :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py index 619930321b8..f4327c3935c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class AppPlatformManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +42,8 @@ def __init__( **kwargs: Any ) -> None: super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +51,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-03-01-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py index 5a32bc04731..eb85bf5b49b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -79,6 +78,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -86,12 +87,17 @@ async def get( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore async def _create_or_update_initial( @@ -123,6 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') @@ -133,6 +140,7 @@ async def _create_or_update_initial( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -140,7 +148,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -158,7 +170,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore @distributed_trace_async @@ -200,8 +212,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +228,7 @@ async def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -239,12 +253,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -258,6 +271,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -265,12 +280,17 @@ async def _delete_initial( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -280,11 +300,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -315,7 +335,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -328,6 +349,7 @@ async def begin_delete( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -348,10 +370,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore @distributed_trace def list( @@ -377,6 +398,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -390,6 +413,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -402,6 +426,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -419,7 +444,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -432,4 +461,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py index 2400cab84c4..81191a45a5e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore async def _create_or_update_initial( @@ -118,6 +124,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') @@ -127,6 +134,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -134,7 +142,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -152,7 +164,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore @distributed_trace_async @@ -189,8 +201,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,6 +216,7 @@ async def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -227,12 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -245,18 +258,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -266,11 +286,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -298,7 +318,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -310,6 +331,7 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -330,10 +352,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore @distributed_trace def list( @@ -356,6 +377,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -368,6 +391,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -379,6 +403,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,7 +421,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,7 +438,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore @distributed_trace_async async def validate_domain( @@ -443,6 +472,7 @@ async def validate_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -452,6 +482,7 @@ async def validate_domain( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -459,7 +490,11 @@ async def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -473,5 +508,5 @@ async def validate_domain( return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py index c25856e85e1..3e3b322b94c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -66,7 +65,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -79,19 +78,26 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, sync_status=sync_status, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore async def _create_or_update_initial( @@ -122,6 +128,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -131,6 +138,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -138,7 +146,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -159,7 +171,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace_async @@ -196,8 +208,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -210,6 +223,7 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -234,12 +248,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -252,18 +265,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -273,11 +293,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -305,7 +325,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -317,6 +338,7 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -337,10 +359,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore async def _update_initial( self, @@ -356,6 +377,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -365,6 +387,7 @@ async def _update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -372,7 +395,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -390,7 +417,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace_async @@ -427,8 +454,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -441,6 +469,7 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -465,10 +494,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace def list( @@ -491,6 +519,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -503,6 +533,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -514,6 +545,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -531,7 +563,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -544,7 +580,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore @distributed_trace_async async def get_resource_upload_url( @@ -574,18 +610,25 @@ async def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,7 +642,7 @@ async def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore async def _set_active_deployments_initial( @@ -616,6 +659,7 @@ async def _set_active_deployments_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') @@ -625,6 +669,7 @@ async def _set_active_deployments_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._set_active_deployments_initial.metadata['url'], @@ -632,7 +677,11 @@ async def _set_active_deployments_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -650,7 +699,7 @@ async def _set_active_deployments_initial( return deserialized - _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore @distributed_trace_async @@ -688,8 +737,9 @@ async def begin_set_active_deployments( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -702,6 +752,7 @@ async def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -726,10 +777,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore @distributed_trace_async async def validate_domain( @@ -763,6 +813,7 @@ async def validate_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -772,6 +823,7 @@ async def validate_domain( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -779,7 +831,11 @@ async def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -793,5 +849,5 @@ async def validate_domain( return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py index 18bc40f856f..7989a7b680e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -79,6 +78,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -86,12 +87,17 @@ async def get( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore async def _create_or_update_initial( @@ -123,6 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -133,6 +140,7 @@ async def _create_or_update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -140,7 +148,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -161,7 +173,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace_async @@ -201,8 +213,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,6 +229,7 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -240,12 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -259,6 +272,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -266,12 +281,17 @@ async def _delete_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -281,11 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -316,7 +336,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -329,6 +350,7 @@ async def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -349,10 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore async def _update_initial( self, @@ -369,6 +390,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -379,6 +401,7 @@ async def _update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -386,7 +409,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -404,7 +431,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace_async @@ -444,8 +471,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,6 +487,7 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -483,10 +512,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace def list( @@ -512,6 +540,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +555,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -537,6 +568,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -554,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -567,4 +603,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py index 26fea28b511..bdfca21c53e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -72,6 +71,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -85,6 +86,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -97,6 +99,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -114,7 +117,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,7 +134,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore @distributed_trace_async async def get( @@ -160,6 +167,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -167,12 +176,17 @@ async def get( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -186,7 +200,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore async def _update_put_initial( @@ -204,6 +218,7 @@ async def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') @@ -214,6 +229,7 @@ async def _update_put_initial( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -221,7 +237,11 @@ async def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -239,7 +259,7 @@ async def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace_async @@ -280,8 +300,9 @@ async def begin_update_put( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -295,6 +316,7 @@ async def begin_update_put( build_service_name=build_service_name, agent_pool_name=agent_pool_name, agent_pool_resource=agent_pool_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -319,7 +341,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py index 5126e4fa954..4a86ced05dc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -79,6 +78,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -86,12 +87,17 @@ async def get( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore async def _create_or_update_initial( @@ -123,6 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(builder_resource, 'BuilderResource') @@ -133,6 +140,7 @@ async def _create_or_update_initial( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -140,7 +148,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -158,7 +170,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore @distributed_trace_async @@ -198,8 +210,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -213,6 +226,7 @@ async def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -237,12 +251,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -256,6 +269,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -263,12 +278,17 @@ async def _delete_initial( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -278,11 +298,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -313,7 +333,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -326,6 +347,7 @@ async def begin_delete( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -346,10 +368,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore @distributed_trace def list( @@ -375,6 +396,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -388,6 +411,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -400,6 +424,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -417,7 +442,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -430,4 +459,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py index 4218cb50e41..60f92c37f7e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -67,6 +66,8 @@ def list_build_services( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -79,6 +80,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list_build_services.metadata['url'], ) request = _convert_request(request) @@ -90,6 +92,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -107,7 +110,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,7 +127,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore @distributed_trace_async async def get_build_service( @@ -150,18 +157,25 @@ async def get_build_service( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_service_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.get_build_service.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,7 +189,7 @@ async def get_build_service( return deserialized - get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore @distributed_trace @@ -201,6 +215,8 @@ def list_builds( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -214,6 +230,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list_builds.metadata['url'], ) request = _convert_request(request) @@ -226,6 +243,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -243,7 +261,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -256,7 +278,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore @distributed_trace_async async def get_build( @@ -289,6 +311,8 @@ async def get_build( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_request( subscription_id=self._config.subscription_id, @@ -296,12 +320,17 @@ async def get_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, template_url=self.get_build.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -315,7 +344,7 @@ async def get_build( return deserialized - get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore @distributed_trace_async @@ -352,6 +381,7 @@ async def create_or_update_build( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(build, 'Build') @@ -362,6 +392,7 @@ async def create_or_update_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update_build.metadata['url'], @@ -369,7 +400,11 @@ async def create_or_update_build( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -387,7 +422,7 @@ async def create_or_update_build( return deserialized - create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore @distributed_trace @@ -417,6 +452,8 @@ def list_build_results( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -431,6 +468,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, template_url=self.list_build_results.metadata['url'], ) request = _convert_request(request) @@ -444,6 +482,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -461,7 +500,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -474,7 +517,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore @distributed_trace_async async def get_build_result( @@ -510,6 +553,8 @@ async def get_build_result( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_result_request( subscription_id=self._config.subscription_id, @@ -518,12 +563,17 @@ async def get_build_result( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, + api_version=api_version, template_url=self.get_build_result.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -537,7 +587,7 @@ async def get_build_result( return deserialized - get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore @distributed_trace_async @@ -574,6 +624,8 @@ async def get_build_result_log( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_result_log_request( subscription_id=self._config.subscription_id, @@ -582,12 +634,17 @@ async def get_build_result_log( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, + api_version=api_version, template_url=self.get_build_result_log.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -601,7 +658,7 @@ async def get_build_result_log( return deserialized - get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore @distributed_trace_async @@ -632,18 +689,25 @@ async def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -657,7 +721,7 @@ async def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore @distributed_trace_async @@ -688,18 +752,25 @@ async def list_supported_buildpacks( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_supported_buildpacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list_supported_buildpacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -713,7 +784,7 @@ async def list_supported_buildpacks( return deserialized - list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore @distributed_trace_async @@ -747,6 +818,8 @@ async def get_supported_buildpack( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_supported_buildpack_request( subscription_id=self._config.subscription_id, @@ -754,12 +827,17 @@ async def get_supported_buildpack( service_name=service_name, build_service_name=build_service_name, buildpack_name=buildpack_name, + api_version=api_version, template_url=self.get_supported_buildpack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -773,7 +851,7 @@ async def get_supported_buildpack( return deserialized - get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore @distributed_trace_async @@ -804,18 +882,25 @@ async def list_supported_stacks( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_supported_stacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list_supported_stacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -829,7 +914,7 @@ async def list_supported_stacks( return deserialized - list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore @distributed_trace_async @@ -863,6 +948,8 @@ async def get_supported_stack( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_supported_stack_request( subscription_id=self._config.subscription_id, @@ -870,12 +957,17 @@ async def get_supported_stack( service_name=service_name, build_service_name=build_service_name, stack_name=stack_name, + api_version=api_version, template_url=self.get_supported_stack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -889,5 +981,5 @@ async def get_supported_stack( return deserialized - get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py index d503ed5a502..aa6c16502f5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -82,6 +81,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -90,12 +91,17 @@ async def get( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,7 +115,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore async def _create_or_update_initial( @@ -128,6 +134,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') @@ -139,6 +146,7 @@ async def _create_or_update_initial( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -146,7 +154,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -164,7 +176,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore @distributed_trace_async @@ -208,8 +220,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -224,6 +237,7 @@ async def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -248,12 +262,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -268,6 +281,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -276,12 +291,17 @@ async def _delete_initial( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -291,11 +311,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -329,7 +349,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -343,6 +364,7 @@ async def begin_delete( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -363,10 +385,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore @distributed_trace def list( @@ -395,6 +416,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -409,6 +432,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -422,6 +446,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -439,7 +464,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -452,4 +481,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py index 55fcada116d..2f9c98801df 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore async def _create_or_update_initial( @@ -118,6 +124,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(certificate_resource, 'CertificateResource') @@ -127,6 +134,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -134,7 +142,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -155,7 +167,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async @@ -193,8 +205,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,6 +220,7 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -231,12 +245,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -249,18 +262,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -270,11 +290,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -302,7 +322,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -314,6 +335,7 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -334,10 +356,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore @distributed_trace def list( @@ -360,6 +381,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -372,6 +395,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -383,6 +407,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -400,7 +425,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -413,4 +442,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py index eba0608f3e9..eb86aa5b680 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -71,17 +70,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -95,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _update_put_initial( @@ -111,6 +117,7 @@ async def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -119,6 +126,7 @@ async def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -126,7 +134,11 @@ async def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -144,7 +156,7 @@ async def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore @distributed_trace_async @@ -179,8 +191,9 @@ async def begin_update_put( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -192,6 +205,7 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -216,10 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _update_patch_initial( self, @@ -234,6 +247,7 @@ async def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -242,6 +256,7 @@ async def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -249,7 +264,11 @@ async def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -267,7 +286,7 @@ async def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore @distributed_trace_async @@ -302,8 +321,9 @@ async def begin_update_patch( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -315,6 +335,7 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -339,10 +360,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore async def _validate_initial( self, @@ -357,6 +377,7 @@ async def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') @@ -365,6 +386,7 @@ async def _validate_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -372,7 +394,11 @@ async def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -390,7 +416,7 @@ async def _validate_initial( return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore @distributed_trace_async @@ -425,8 +451,9 @@ async def begin_validate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -438,6 +465,7 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -462,7 +490,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py index c5b83d3c1e0..1a7089b8ab8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore async def _create_or_update_initial( @@ -118,6 +124,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') @@ -127,6 +134,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -134,7 +142,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -152,7 +164,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore @distributed_trace_async @@ -191,8 +203,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -205,6 +218,7 @@ async def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -229,12 +243,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -247,18 +260,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -268,11 +288,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -300,7 +320,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -312,6 +333,7 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -332,10 +354,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore @distributed_trace def list( @@ -358,6 +379,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -370,6 +393,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -381,6 +405,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -398,7 +423,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -411,7 +440,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore async def _validate_initial( self, @@ -427,6 +456,7 @@ async def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(settings, 'ConfigurationServiceSettings') @@ -436,6 +466,7 @@ async def _validate_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -443,7 +474,11 @@ async def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -461,7 +496,7 @@ async def _validate_initial( return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore @distributed_trace_async @@ -498,8 +533,9 @@ async def begin_validate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -512,6 +548,7 @@ async def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -536,7 +573,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py index a3535c5c5fd..16ef55ae2d7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -79,6 +78,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -86,12 +87,17 @@ async def get( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore async def _create_or_update_initial( @@ -123,6 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -133,6 +140,7 @@ async def _create_or_update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -140,7 +148,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -161,7 +173,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace_async @@ -201,8 +213,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,6 +229,7 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -240,12 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -259,6 +272,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -266,12 +281,17 @@ async def _delete_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -281,11 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -316,7 +336,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -329,6 +350,7 @@ async def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -349,10 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore async def _update_initial( self, @@ -369,6 +390,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -379,6 +401,7 @@ async def _update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -386,7 +409,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -404,7 +431,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace_async @@ -444,8 +471,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -459,6 +487,7 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -483,10 +512,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace def list( @@ -512,6 +540,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -525,6 +555,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -537,6 +568,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -554,7 +586,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -567,4 +603,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py index 52dcd963b3a..0aa9463a082 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -26,7 +25,7 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DeploymentsOperations: +class DeploymentsOperations: # pylint: disable=too-many-public-methods """DeploymentsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -79,6 +78,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -86,12 +87,17 @@ async def get( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore async def _create_or_update_initial( @@ -123,6 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -133,6 +140,7 @@ async def _create_or_update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -140,7 +148,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -161,7 +173,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace_async @@ -202,8 +214,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -217,6 +230,7 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -241,12 +255,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -260,6 +273,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -267,12 +282,17 @@ async def _delete_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -282,11 +302,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -317,7 +337,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -330,6 +351,7 @@ async def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -350,10 +372,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore async def _update_initial( self, @@ -370,6 +391,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -380,6 +402,7 @@ async def _update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -387,7 +410,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -405,7 +432,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace_async @@ -446,8 +473,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -461,6 +489,7 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -485,10 +514,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace def list( @@ -508,7 +536,7 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -517,6 +545,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -530,6 +560,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, version=version, template_url=self.list.metadata['url'], ) @@ -543,6 +574,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, version=version, template_url=next_link, ) @@ -561,7 +593,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -574,7 +610,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore @distributed_trace def list_for_cluster( @@ -591,7 +627,7 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -600,6 +636,8 @@ def list_for_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -612,6 +650,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, version=version, template_url=self.list_for_cluster.metadata['url'], ) @@ -624,6 +663,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, version=version, template_url=next_link, ) @@ -642,7 +682,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -655,9 +699,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -671,6 +715,8 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_start_request_initial( subscription_id=self._config.subscription_id, @@ -678,12 +724,17 @@ async def _start_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -693,11 +744,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -728,7 +779,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -741,6 +793,7 @@ async def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -761,12 +814,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - async def _stop_initial( + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -780,6 +832,8 @@ async def _stop_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_stop_request_initial( subscription_id=self._config.subscription_id, @@ -787,12 +841,17 @@ async def _stop_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -802,11 +861,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -837,7 +896,8 @@ async def begin_stop( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -850,6 +910,7 @@ async def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -870,12 +931,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - async def _restart_initial( + async def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -889,6 +949,8 @@ async def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_restart_request_initial( subscription_id=self._config.subscription_id, @@ -896,12 +958,17 @@ async def _restart_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -911,11 +978,11 @@ async def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore @distributed_trace_async - async def begin_restart( + async def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -946,7 +1013,8 @@ async def begin_restart( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -959,6 +1027,7 @@ async def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -979,10 +1048,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore @distributed_trace_async async def get_log_file_url( @@ -1015,6 +1083,8 @@ async def get_log_file_url( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_log_file_url_request( subscription_id=self._config.subscription_id, @@ -1022,12 +1092,17 @@ async def get_log_file_url( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self.get_log_file_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1043,10 +1118,10 @@ async def get_log_file_url( return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - async def _generate_heap_dump_initial( + async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1061,6 +1136,7 @@ async def _generate_heap_dump_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1071,6 +1147,7 @@ async def _generate_heap_dump_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_heap_dump_initial.metadata['url'], @@ -1078,7 +1155,11 @@ async def _generate_heap_dump_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1088,11 +1169,11 @@ async def _generate_heap_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore @distributed_trace_async - async def begin_generate_heap_dump( + async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1127,8 +1208,9 @@ async def begin_generate_heap_dump( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1142,6 +1224,7 @@ async def begin_generate_heap_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1163,12 +1246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - async def _generate_thread_dump_initial( + async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1183,6 +1265,7 @@ async def _generate_thread_dump_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1193,6 +1276,7 @@ async def _generate_thread_dump_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_thread_dump_initial.metadata['url'], @@ -1200,7 +1284,11 @@ async def _generate_thread_dump_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1210,11 +1298,11 @@ async def _generate_thread_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore @distributed_trace_async - async def begin_generate_thread_dump( + async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1249,8 +1337,9 @@ async def begin_generate_thread_dump( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1264,6 +1353,7 @@ async def begin_generate_thread_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1285,12 +1375,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - async def _start_jfr_initial( + async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1305,6 +1394,7 @@ async def _start_jfr_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1315,6 +1405,7 @@ async def _start_jfr_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._start_jfr_initial.metadata['url'], @@ -1322,7 +1413,11 @@ async def _start_jfr_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1332,11 +1427,11 @@ async def _start_jfr_initial( if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore @distributed_trace_async - async def begin_start_jfr( + async def begin_start_jfr( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1371,8 +1466,9 @@ async def begin_start_jfr( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1386,6 +1482,7 @@ async def begin_start_jfr( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1407,7 +1504,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py index 5bd88c74a45..f995109bebe 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -79,6 +78,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -86,12 +87,17 @@ async def get( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore async def _create_or_update_initial( @@ -123,6 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') @@ -133,6 +140,7 @@ async def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -140,7 +148,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -158,7 +170,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore @distributed_trace_async @@ -200,8 +212,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -215,6 +228,7 @@ async def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -239,12 +253,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -258,6 +271,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -265,12 +280,17 @@ async def _delete_initial( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -280,11 +300,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -315,7 +335,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -328,6 +349,7 @@ async def begin_delete( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -348,10 +370,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore @distributed_trace def list( @@ -377,6 +398,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -390,6 +413,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -402,6 +426,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -419,7 +444,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -432,4 +461,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py index 460f7dc4328..e7a4938113f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -79,6 +78,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -86,12 +87,17 @@ async def get( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -105,7 +111,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore async def _create_or_update_initial( @@ -123,6 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') @@ -133,6 +140,7 @@ async def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -140,7 +148,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -158,7 +170,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore @distributed_trace_async @@ -201,8 +213,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,6 +229,7 @@ async def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -240,12 +254,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -259,6 +272,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -266,12 +281,17 @@ async def _delete_initial( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -281,11 +301,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -316,7 +336,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -329,6 +350,7 @@ async def begin_delete( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -349,10 +371,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore @distributed_trace def list( @@ -378,6 +399,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -391,6 +414,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -403,6 +427,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -420,7 +445,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -433,4 +462,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py index 444722d3331..4e5d0927d6a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore async def _create_or_update_initial( @@ -118,6 +124,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_resource, 'GatewayResource') @@ -127,6 +134,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -134,7 +142,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -152,7 +164,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore @distributed_trace_async @@ -189,8 +201,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,6 +216,7 @@ async def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -227,12 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -245,18 +258,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -266,11 +286,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -298,7 +318,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -310,6 +331,7 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -330,10 +352,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore @distributed_trace def list( @@ -356,6 +377,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -368,6 +391,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -379,6 +403,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -396,7 +421,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -409,7 +438,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore @distributed_trace_async async def validate_domain( @@ -443,6 +472,7 @@ async def validate_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -452,6 +482,7 @@ async def validate_domain( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -459,7 +490,11 @@ async def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -473,5 +508,5 @@ async def validate_domain( return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py index 76c99d5d286..300216417b0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -71,17 +70,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -95,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore async def _update_put_initial( @@ -111,6 +117,7 @@ async def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -119,6 +126,7 @@ async def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -126,7 +134,11 @@ async def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -144,7 +156,7 @@ async def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore @distributed_trace_async @@ -179,8 +191,9 @@ async def begin_update_put( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -192,6 +205,7 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -216,10 +230,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore async def _update_patch_initial( self, @@ -234,6 +247,7 @@ async def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -242,6 +256,7 @@ async def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -249,7 +264,11 @@ async def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -267,7 +286,7 @@ async def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore @distributed_trace_async @@ -302,8 +321,9 @@ async def begin_update_patch( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -315,6 +335,7 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -339,7 +360,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py index 82cb8a1a31d..361418cd51e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -59,6 +57,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -68,6 +68,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -76,6 +77,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -93,7 +95,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,4 +112,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py index b6d3f4140df..de591e0bc63 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -62,14 +61,21 @@ async def list_runtime_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_runtime_versions_request( + api_version=api_version, template_url=self.list_runtime_versions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -83,5 +89,5 @@ async def list_runtime_versions( return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py index 19cd77b04ac..8280787fcd0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore async def _create_or_update_initial( @@ -117,18 +123,25 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, template_url=self._create_or_update_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -146,7 +159,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore @distributed_trace_async @@ -180,7 +193,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -192,6 +206,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -215,12 +230,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -233,18 +247,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -254,11 +275,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -286,7 +307,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -298,6 +320,7 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -318,10 +341,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore @distributed_trace def list( @@ -344,6 +366,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -356,6 +380,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -367,6 +392,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -384,7 +410,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -397,4 +427,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py index 7a35a54127a..33d5db18689 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -73,17 +72,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,7 +103,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore async def _create_or_update_initial( @@ -113,6 +119,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -121,6 +128,7 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -128,7 +136,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -149,7 +161,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace_async @@ -183,8 +195,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,6 +209,7 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -220,12 +234,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -237,17 +250,24 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -257,11 +277,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -286,7 +306,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -297,6 +318,7 @@ async def begin_delete( raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -317,10 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore async def _update_initial( self, @@ -335,6 +356,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -343,6 +365,7 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -350,7 +373,11 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -368,7 +395,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace_async @@ -402,8 +429,9 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -415,6 +443,7 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -439,10 +468,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace_async async def list_test_keys( @@ -469,17 +497,24 @@ async def list_test_keys( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_test_keys_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list_test_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -493,7 +528,7 @@ async def list_test_keys( return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore @distributed_trace_async @@ -525,6 +560,7 @@ async def regenerate_test_key( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') @@ -533,6 +569,7 @@ async def regenerate_test_key( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_test_key.metadata['url'], @@ -540,7 +577,11 @@ async def regenerate_test_key( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -554,11 +595,11 @@ async def regenerate_test_key( return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore @distributed_trace_async - async def disable_test_endpoint( + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -582,17 +623,24 @@ async def disable_test_endpoint( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_disable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.disable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -602,7 +650,7 @@ async def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore @distributed_trace_async @@ -630,17 +678,24 @@ async def enable_test_endpoint( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_enable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.enable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -654,10 +709,10 @@ async def enable_test_endpoint( return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - async def _stop_initial( + async def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -669,17 +724,24 @@ async def _stop_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_stop_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -689,11 +751,11 @@ async def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore @distributed_trace_async - async def begin_stop( + async def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -718,7 +780,8 @@ async def begin_stop( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -729,6 +792,7 @@ async def begin_stop( raw_result = await self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -749,12 +813,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - async def _start_initial( + async def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -766,17 +829,24 @@ async def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_start_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -786,11 +856,11 @@ async def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore @distributed_trace_async - async def begin_start( + async def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -815,7 +885,8 @@ async def begin_start( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -826,6 +897,7 @@ async def begin_start( raw_result = await self._start_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -846,10 +918,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore @distributed_trace_async async def check_name_availability( @@ -876,6 +947,7 @@ async def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') @@ -883,6 +955,7 @@ async def check_name_availability( request = build_check_name_availability_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -890,7 +963,11 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -904,7 +981,7 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore @distributed_trace @@ -920,6 +997,8 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -930,6 +1009,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -939,6 +1019,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -956,7 +1037,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -969,7 +1054,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore @distributed_trace def list( @@ -988,6 +1073,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -999,6 +1086,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -1009,6 +1097,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1026,7 +1115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1039,4 +1132,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py index 8357feb9b98..e9236ff4f7c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -70,6 +70,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -79,6 +80,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -96,7 +98,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,4 +115,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py index 03184f78f55..b9f288e180a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore async def _create_or_update_initial( @@ -118,6 +124,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(storage_resource, 'StorageResource') @@ -127,6 +134,7 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -134,7 +142,11 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -155,7 +167,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore @distributed_trace_async @@ -192,8 +204,9 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,6 +219,7 @@ async def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -230,12 +244,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -248,18 +261,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -269,11 +289,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -301,7 +321,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -313,6 +334,7 @@ async def begin_delete( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -333,10 +355,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore @distributed_trace def list( @@ -359,6 +380,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -371,6 +394,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -382,6 +406,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -399,7 +424,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -412,4 +441,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py index 08452944979..b80473e23b3 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py @@ -201,10 +201,12 @@ ResourceSkuRestrictionsType, ServiceRegistryProvisioningState, SkuScaleType, + StorageType, SupportedRuntimePlatform, SupportedRuntimeValue, TestKeyType, TrafficDirection, + Type, ) __all__ = [ @@ -400,8 +402,10 @@ 'ResourceSkuRestrictionsType', 'ServiceRegistryProvisioningState', 'SkuScaleType', + 'StorageType', 'SupportedRuntimePlatform', 'SupportedRuntimeValue', 'TestKeyType', 'TrafficDirection', + 'Type', ] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py index ba15077e4fc..b10f39b3966 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py @@ -245,6 +245,12 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" +class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the storage. + """ + + STORAGE_ACCOUNT = "StorageAccount" + class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ @@ -274,3 +280,9 @@ class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INBOUND = "Inbound" OUTBOUND = "Outbound" + +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the underlying resource to mount as a persistent disk. + """ + + AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py index 354a8f5f823..94ce69f1339 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py @@ -310,8 +310,8 @@ class ApiPortalProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = None, - https_only: Optional[bool] = None, + public: Optional[bool] = False, + https_only: Optional[bool] = False, gateway_ids: Optional[List[str]] = None, source_urls: Optional[List[str]] = None, sso_properties: Optional["SsoProperties"] = None, @@ -756,8 +756,8 @@ class CustomPersistentDiskProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. - :vartype type: str + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.Type :ivar mount_path: Required. The mount path of the persistent disk. :vartype mount_path: str :ivar read_only: Indicates whether the persistent disk is a readOnly one. @@ -811,8 +811,8 @@ class AzureFileVolume(CustomPersistentDiskProperties): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. - :vartype type: str + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.Type :ivar mount_path: Required. The mount path of the persistent disk. :vartype mount_path: str :ivar read_only: Indicates whether the persistent disk is a readOnly one. @@ -4323,8 +4323,8 @@ class GatewayProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = None, - https_only: Optional[bool] = None, + public: Optional[bool] = False, + https_only: Optional[bool] = False, sso_properties: Optional["SsoProperties"] = None, api_metadata_properties: Optional["GatewayApiMetadataProperties"] = None, cors_properties: Optional["GatewayCorsProperties"] = None, @@ -6870,8 +6870,9 @@ class StorageProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. - :vartype storage_type: str + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageType """ _validation = { @@ -6901,8 +6902,9 @@ class StorageAccount(StorageProperties): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. - :vartype storage_type: str + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageType :ivar account_name: Required. The account name of the Azure Storage Account. :vartype account_name: str :ivar account_key: Required. The account key of the Azure Storage Account. diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py index e98ddbbd5d2..83ed21ad8d2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -124,10 +125,11 @@ def build_delete_request_initial( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), @@ -136,21 +138,21 @@ def build_delete_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,10 +164,11 @@ def build_list_request( api_portal_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains") # 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'), @@ -173,21 +176,21 @@ def build_list_request( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -244,6 +247,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -251,12 +256,17 @@ def get( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,7 +280,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore def _create_or_update_initial( @@ -288,6 +298,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') @@ -298,6 +309,7 @@ def _create_or_update_initial( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -305,7 +317,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -323,7 +339,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore @distributed_trace @@ -365,8 +381,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -380,6 +397,7 @@ def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -404,12 +422,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -423,6 +440,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -430,12 +449,17 @@ def _delete_initial( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -445,11 +469,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -480,7 +504,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -493,6 +518,7 @@ def begin_delete( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -513,10 +539,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore @distributed_trace def list( @@ -542,6 +567,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -555,6 +582,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -567,6 +595,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -584,7 +613,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -597,4 +630,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py index 2336184687b..978468a0daf 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( api_portal_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), @@ -47,21 +48,21 @@ def build_get_request( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), @@ -89,23 +90,23 @@ def build_create_or_update_request_initial( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -119,10 +120,11 @@ def build_delete_request_initial( api_portal_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -194,12 +197,12 @@ def build_validate_domain_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain") # 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'), @@ -207,23 +210,23 @@ def build_validate_domain_request( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -279,18 +282,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -304,7 +314,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore def _create_or_update_initial( @@ -321,6 +331,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') @@ -330,6 +341,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -337,7 +349,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -355,7 +371,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore @distributed_trace @@ -392,8 +408,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -406,6 +423,7 @@ def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -430,12 +448,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -448,18 +465,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -469,11 +493,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -501,7 +525,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +538,7 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -533,10 +559,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore @distributed_trace def list( @@ -559,6 +584,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -571,6 +598,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -582,6 +610,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -599,7 +628,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -612,7 +645,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore @distributed_trace def validate_domain( @@ -646,6 +679,7 @@ def validate_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -655,6 +689,7 @@ def validate_domain( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -662,7 +697,11 @@ def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -676,5 +715,5 @@ def validate_domain( return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py index 15a784cf08c..6b71e487a5f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,10 +38,11 @@ def build_get_request( sync_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), @@ -49,23 +50,23 @@ def build_get_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if sync_status is not None: - query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -80,12 +81,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -123,10 +124,11 @@ def build_delete_request_initial( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), @@ -134,21 +136,21 @@ def build_delete_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -163,12 +165,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), @@ -176,23 +178,23 @@ def build_update_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -205,31 +207,32 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -241,10 +244,11 @@ def build_get_resource_upload_url_request( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), @@ -252,21 +256,21 @@ def build_get_resource_upload_url_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -281,12 +285,12 @@ def build_set_active_deployments_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # 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'), @@ -294,23 +298,23 @@ def build_set_active_deployments_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -327,12 +331,12 @@ def build_validate_domain_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), @@ -340,23 +344,23 @@ def build_validate_domain_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -402,7 +406,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. + :param sync_status: Indicates whether sync status. Default value is None. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -415,19 +419,26 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, sync_status=sync_status, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,7 +452,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore def _create_or_update_initial( @@ -458,6 +469,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -467,6 +479,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -474,7 +487,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -495,7 +512,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace @@ -532,8 +549,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -546,6 +564,7 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -570,12 +589,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -588,18 +606,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -609,11 +634,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -641,7 +666,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -653,6 +679,7 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -673,10 +700,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore def _update_initial( self, @@ -692,6 +718,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -701,6 +728,7 @@ def _update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -708,7 +736,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -726,7 +758,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace @@ -763,8 +795,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -777,6 +810,7 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -801,10 +835,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore @distributed_trace def list( @@ -827,6 +860,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -839,6 +874,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -850,6 +886,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -867,7 +904,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -880,7 +921,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore @distributed_trace def get_resource_upload_url( @@ -910,18 +951,25 @@ def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -935,7 +983,7 @@ def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore def _set_active_deployments_initial( @@ -952,6 +1000,7 @@ def _set_active_deployments_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') @@ -961,6 +1010,7 @@ def _set_active_deployments_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._set_active_deployments_initial.metadata['url'], @@ -968,7 +1018,11 @@ def _set_active_deployments_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -986,7 +1040,7 @@ def _set_active_deployments_initial( return deserialized - _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore @distributed_trace @@ -1024,8 +1078,9 @@ def begin_set_active_deployments( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -1038,6 +1093,7 @@ def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1062,10 +1118,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore @distributed_trace def validate_domain( @@ -1099,6 +1154,7 @@ def validate_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -1108,6 +1164,7 @@ def validate_domain( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -1115,7 +1172,11 @@ def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1129,5 +1190,5 @@ def validate_domain( return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py index 6b8ad8ac251..4e59ea12b28 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -124,10 +125,11 @@ def build_delete_request_initial( binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), @@ -136,21 +138,21 @@ def build_delete_request_initial( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,12 +168,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), @@ -180,23 +182,23 @@ def build_update_request_initial( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -210,10 +212,11 @@ def build_list_request( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), @@ -221,21 +224,21 @@ def build_list_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,6 +295,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -299,12 +304,17 @@ def get( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -318,7 +328,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore def _create_or_update_initial( @@ -336,6 +346,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -346,6 +357,7 @@ def _create_or_update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -353,7 +365,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -374,7 +390,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace @@ -414,8 +430,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -429,6 +446,7 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -453,12 +471,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -472,6 +489,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -479,12 +498,17 @@ def _delete_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -494,11 +518,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -529,7 +553,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -542,6 +567,7 @@ def begin_delete( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -562,10 +588,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore def _update_initial( self, @@ -582,6 +607,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -592,6 +618,7 @@ def _update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -599,7 +626,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -617,7 +648,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace @@ -657,8 +688,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -672,6 +704,7 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -696,10 +729,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore @distributed_trace def list( @@ -725,6 +757,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -738,6 +772,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -750,6 +785,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -767,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,4 +820,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py index 548f2759609..15a896ee5e4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_list_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # 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'), @@ -47,21 +48,21 @@ def build_list_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -74,10 +75,11 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), @@ -86,21 +88,21 @@ def build_get_request( "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,12 +118,12 @@ def build_update_put_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), @@ -130,23 +132,23 @@ def build_update_put_request_initial( "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -198,6 +200,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -211,6 +215,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -223,6 +228,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -240,7 +246,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -253,7 +263,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore @distributed_trace def get( @@ -286,6 +296,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -293,12 +305,17 @@ def get( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -312,7 +329,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore def _update_put_initial( @@ -330,6 +347,7 @@ def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') @@ -340,6 +358,7 @@ def _update_put_initial( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -347,7 +366,11 @@ def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -365,7 +388,7 @@ def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore @distributed_trace @@ -406,8 +429,9 @@ def begin_update_put( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -421,6 +445,7 @@ def begin_update_put( build_service_name=build_service_name, agent_pool_name=agent_pool_name, agent_pool_resource=agent_pool_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -445,7 +470,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py index f02385c6022..352dd8f8129 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( builder_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), @@ -49,21 +50,21 @@ def build_get_request( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -124,10 +125,11 @@ def build_delete_request_initial( builder_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), @@ -136,21 +138,21 @@ def build_delete_request_initial( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,10 +164,11 @@ def build_list_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), @@ -173,21 +176,21 @@ def build_list_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -244,6 +247,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -251,12 +256,17 @@ def get( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,7 +280,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore def _create_or_update_initial( @@ -288,6 +298,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(builder_resource, 'BuilderResource') @@ -298,6 +309,7 @@ def _create_or_update_initial( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -305,7 +317,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -323,7 +339,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore @distributed_trace @@ -363,8 +379,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -378,6 +395,7 @@ def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -402,12 +420,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -421,6 +438,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -428,12 +447,17 @@ def _delete_initial( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -443,11 +467,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -478,7 +502,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -491,6 +516,7 @@ def begin_delete( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -511,10 +537,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore @distributed_trace def list( @@ -540,6 +565,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -553,6 +580,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -565,6 +593,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -582,7 +611,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -595,4 +628,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py index a642efb1678..4629634f8c1 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,31 +33,32 @@ def build_list_build_services_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -69,10 +70,11 @@ def build_get_build_service_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # 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'), @@ -80,21 +82,21 @@ def build_get_build_service_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -106,10 +108,11 @@ def build_list_builds_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), @@ -117,21 +120,21 @@ def build_list_builds_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -144,10 +147,11 @@ def build_get_build_request( build_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), @@ -156,21 +160,21 @@ def build_get_build_request( "buildName": _SERIALIZER.url("build_name", build_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -186,12 +190,12 @@ def build_create_or_update_build_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), @@ -200,23 +204,23 @@ def build_create_or_update_build_request( "buildName": _SERIALIZER.url("build_name", build_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -231,10 +235,11 @@ def build_list_build_results_request( build_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # 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'), @@ -243,21 +248,21 @@ def build_list_build_results_request( "buildName": _SERIALIZER.url("build_name", build_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -271,10 +276,11 @@ def build_get_build_result_request( build_result_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # 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'), @@ -284,21 +290,21 @@ def build_get_build_result_request( "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -312,10 +318,11 @@ def build_get_build_result_log_request( build_result_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # 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'), @@ -325,21 +332,21 @@ def build_get_build_result_log_request( "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -351,10 +358,11 @@ def build_get_resource_upload_url_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # 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'), @@ -362,21 +370,21 @@ def build_get_resource_upload_url_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -388,10 +396,11 @@ def build_list_supported_buildpacks_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # 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'), @@ -399,21 +408,21 @@ def build_list_supported_buildpacks_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -426,10 +435,11 @@ def build_get_supported_buildpack_request( buildpack_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # 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'), @@ -438,21 +448,21 @@ def build_get_supported_buildpack_request( "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -464,10 +474,11 @@ def build_list_supported_stacks_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # 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'), @@ -475,21 +486,21 @@ def build_list_supported_stacks_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -502,10 +513,11 @@ def build_get_supported_stack_request( stack_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # 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'), @@ -514,21 +526,21 @@ def build_get_supported_stack_request( "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -575,6 +587,8 @@ def list_build_services( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -587,6 +601,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list_build_services.metadata['url'], ) request = _convert_request(request) @@ -598,6 +613,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -615,7 +631,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -628,7 +648,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore @distributed_trace def get_build_service( @@ -658,18 +678,25 @@ def get_build_service( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_service_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.get_build_service.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -683,7 +710,7 @@ def get_build_service( return deserialized - get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore @distributed_trace @@ -709,6 +736,8 @@ def list_builds( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -722,6 +751,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list_builds.metadata['url'], ) request = _convert_request(request) @@ -734,6 +764,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -751,7 +782,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -764,7 +799,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore @distributed_trace def get_build( @@ -797,6 +832,8 @@ def get_build( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_request( subscription_id=self._config.subscription_id, @@ -804,12 +841,17 @@ def get_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, template_url=self.get_build.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -823,7 +865,7 @@ def get_build( return deserialized - get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore @distributed_trace @@ -860,6 +902,7 @@ def create_or_update_build( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(build, 'Build') @@ -870,6 +913,7 @@ def create_or_update_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update_build.metadata['url'], @@ -877,7 +921,11 @@ def create_or_update_build( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -895,7 +943,7 @@ def create_or_update_build( return deserialized - create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore @distributed_trace @@ -925,6 +973,8 @@ def list_build_results( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -939,6 +989,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, template_url=self.list_build_results.metadata['url'], ) request = _convert_request(request) @@ -952,6 +1003,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -969,7 +1021,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -982,7 +1038,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore @distributed_trace def get_build_result( @@ -1018,6 +1074,8 @@ def get_build_result( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_result_request( subscription_id=self._config.subscription_id, @@ -1026,12 +1084,17 @@ def get_build_result( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, + api_version=api_version, template_url=self.get_build_result.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1045,7 +1108,7 @@ def get_build_result( return deserialized - get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore @distributed_trace @@ -1082,6 +1145,8 @@ def get_build_result_log( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_build_result_log_request( subscription_id=self._config.subscription_id, @@ -1090,12 +1155,17 @@ def get_build_result_log( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, + api_version=api_version, template_url=self.get_build_result_log.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1109,7 +1179,7 @@ def get_build_result_log( return deserialized - get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore @distributed_trace @@ -1140,18 +1210,25 @@ def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1165,7 +1242,7 @@ def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore @distributed_trace @@ -1196,18 +1273,25 @@ def list_supported_buildpacks( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_supported_buildpacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list_supported_buildpacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1221,7 +1305,7 @@ def list_supported_buildpacks( return deserialized - list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore @distributed_trace @@ -1255,6 +1339,8 @@ def get_supported_buildpack( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_supported_buildpack_request( subscription_id=self._config.subscription_id, @@ -1262,12 +1348,17 @@ def get_supported_buildpack( service_name=service_name, build_service_name=build_service_name, buildpack_name=buildpack_name, + api_version=api_version, template_url=self.get_supported_buildpack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1281,7 +1372,7 @@ def get_supported_buildpack( return deserialized - get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore @distributed_trace @@ -1312,18 +1403,25 @@ def list_supported_stacks( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_supported_stacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, + api_version=api_version, template_url=self.list_supported_stacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1337,7 +1435,7 @@ def list_supported_stacks( return deserialized - list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore @distributed_trace @@ -1371,6 +1469,8 @@ def get_supported_stack( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_supported_stack_request( subscription_id=self._config.subscription_id, @@ -1378,12 +1478,17 @@ def get_supported_stack( service_name=service_name, build_service_name=build_service_name, stack_name=stack_name, + api_version=api_version, template_url=self.get_supported_stack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1397,5 +1502,5 @@ def get_supported_stack( return deserialized - get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py index 068152705e9..8df841baf9b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,10 +38,11 @@ def build_get_request( buildpack_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), @@ -51,21 +52,21 @@ def build_get_request( "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -82,12 +83,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), @@ -97,23 +98,23 @@ def build_create_or_update_request_initial( "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -129,10 +130,11 @@ def build_delete_request_initial( buildpack_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), @@ -142,21 +144,21 @@ def build_delete_request_initial( "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -169,10 +171,11 @@ def build_list_request( builder_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # 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'), @@ -181,21 +184,21 @@ def build_list_request( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -255,6 +258,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -263,12 +268,17 @@ def get( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -282,7 +292,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore def _create_or_update_initial( @@ -301,6 +311,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') @@ -312,6 +323,7 @@ def _create_or_update_initial( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -319,7 +331,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -337,7 +353,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore @distributed_trace @@ -381,8 +397,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -397,6 +414,7 @@ def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -421,12 +439,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -441,6 +458,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -449,12 +468,17 @@ def _delete_initial( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -464,11 +488,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -502,7 +526,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -516,6 +541,7 @@ def begin_delete( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -536,10 +562,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore @distributed_trace def list( @@ -568,6 +593,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,6 +609,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -595,6 +623,7 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -612,7 +641,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -625,4 +658,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py index 7d35d013c1b..9a6735a7505 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), @@ -47,21 +48,21 @@ def build_get_request( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), @@ -89,23 +90,23 @@ def build_create_or_update_request_initial( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -119,10 +120,11 @@ def build_delete_request_initial( certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,18 +236,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -258,7 +268,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore def _create_or_update_initial( @@ -275,6 +285,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(certificate_resource, 'CertificateResource') @@ -284,6 +295,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -291,7 +303,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -312,7 +328,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore @distributed_trace @@ -350,8 +366,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -364,6 +381,7 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -388,12 +406,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -406,18 +423,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -427,11 +451,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -459,7 +483,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -471,6 +496,7 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -491,10 +517,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore @distributed_trace def list( @@ -517,6 +542,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -529,6 +556,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -540,6 +568,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -557,7 +586,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -570,4 +603,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py index 0619baa15e5..75f20a2a7af 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,31 +34,32 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,35 +73,35 @@ def build_update_put_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -116,35 +117,35 @@ def build_update_patch_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -160,35 +161,35 @@ def build_validate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -241,17 +242,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -265,7 +273,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _update_put_initial( @@ -281,6 +289,7 @@ def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -289,6 +298,7 @@ def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -296,7 +306,11 @@ def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -314,7 +328,7 @@ def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore @distributed_trace @@ -349,8 +363,9 @@ def begin_update_put( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -362,6 +377,7 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -386,10 +402,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _update_patch_initial( self, @@ -404,6 +419,7 @@ def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -412,6 +428,7 @@ def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -419,7 +436,11 @@ def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -437,7 +458,7 @@ def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore @distributed_trace @@ -472,8 +493,9 @@ def begin_update_patch( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -485,6 +507,7 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -509,10 +532,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore def _validate_initial( self, @@ -527,6 +549,7 @@ def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') @@ -535,6 +558,7 @@ def _validate_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -542,7 +566,11 @@ def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -560,7 +588,7 @@ def _validate_initial( return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore @distributed_trace @@ -595,8 +623,9 @@ def begin_validate( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -608,6 +637,7 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -632,7 +662,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py index d608556a3c7..07a5d39d525 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( configuration_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), @@ -47,21 +48,21 @@ def build_get_request( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), @@ -89,23 +90,23 @@ def build_create_or_update_request_initial( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -119,10 +120,11 @@ def build_delete_request_initial( configuration_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -194,12 +197,12 @@ def build_validate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # 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'), @@ -207,23 +210,23 @@ def build_validate_request_initial( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -279,18 +282,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -304,7 +314,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore def _create_or_update_initial( @@ -321,6 +331,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') @@ -330,6 +341,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -337,7 +349,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -355,7 +371,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore @distributed_trace @@ -394,8 +410,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -408,6 +425,7 @@ def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -432,12 +450,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -450,18 +467,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -471,11 +495,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -503,7 +527,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -515,6 +540,7 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -535,10 +561,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore @distributed_trace def list( @@ -561,6 +586,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -573,6 +600,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -584,6 +612,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -601,7 +630,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -614,7 +647,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore def _validate_initial( self, @@ -630,6 +663,7 @@ def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(settings, 'ConfigurationServiceSettings') @@ -639,6 +673,7 @@ def _validate_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -646,7 +681,11 @@ def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -664,7 +703,7 @@ def _validate_initial( return deserialized - _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore @distributed_trace @@ -701,8 +740,9 @@ def begin_validate( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -715,6 +755,7 @@ def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -739,7 +780,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py index 0ad2172363c..d3acd61a5e8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -124,10 +125,11 @@ def build_delete_request_initial( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), @@ -136,21 +138,21 @@ def build_delete_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,12 +168,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), @@ -180,23 +182,23 @@ def build_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -210,10 +212,11 @@ def build_list_request( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), @@ -221,21 +224,21 @@ def build_list_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -292,6 +295,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -299,12 +304,17 @@ def get( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -318,7 +328,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore def _create_or_update_initial( @@ -336,6 +346,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -346,6 +357,7 @@ def _create_or_update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -353,7 +365,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -374,7 +390,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace @@ -414,8 +430,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -429,6 +446,7 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -453,12 +471,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -472,6 +489,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -479,12 +498,17 @@ def _delete_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -494,11 +518,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -529,7 +553,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -542,6 +567,7 @@ def begin_delete( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -562,10 +588,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore def _update_initial( self, @@ -582,6 +607,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -592,6 +618,7 @@ def _update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -599,7 +626,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -617,7 +648,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace @@ -657,8 +688,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -672,6 +704,7 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -696,10 +729,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore @distributed_trace def list( @@ -725,6 +757,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -738,6 +772,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -750,6 +785,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -767,7 +803,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -780,4 +820,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py index 3a9803f2bd3..173c689fdf2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -124,10 +125,11 @@ def build_delete_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), @@ -136,21 +138,21 @@ def build_delete_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -166,12 +168,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), @@ -180,23 +182,23 @@ def build_update_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -212,10 +214,11 @@ def build_list_request( version: Optional[List[str]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), @@ -223,23 +226,23 @@ def build_list_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -252,33 +255,34 @@ def build_list_for_cluster_request( version: Optional[List[str]] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if version is not None: - query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -291,10 +295,11 @@ def build_start_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), @@ -303,21 +308,21 @@ def build_start_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -330,10 +335,11 @@ def build_stop_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), @@ -342,21 +348,21 @@ def build_stop_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -369,10 +375,11 @@ def build_restart_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), @@ -381,21 +388,21 @@ def build_restart_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -408,10 +415,11 @@ def build_get_log_file_url_request( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), @@ -420,21 +428,21 @@ def build_get_log_file_url_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -450,12 +458,12 @@ def build_generate_heap_dump_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), @@ -464,23 +472,23 @@ def build_generate_heap_dump_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -498,12 +506,12 @@ def build_generate_thread_dump_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), @@ -512,23 +520,23 @@ def build_generate_thread_dump_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -546,12 +554,12 @@ def build_start_jfr_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # 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'), @@ -560,29 +568,29 @@ def build_start_jfr_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -class DeploymentsOperations(object): +class DeploymentsOperations(object): # pylint: disable=too-many-public-methods """DeploymentsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -635,6 +643,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -642,12 +652,17 @@ def get( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -661,7 +676,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore def _create_or_update_initial( @@ -679,6 +694,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -689,6 +705,7 @@ def _create_or_update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -696,7 +713,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -717,7 +738,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace @@ -758,8 +779,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -773,6 +795,7 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -797,12 +820,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -816,6 +838,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -823,12 +847,17 @@ def _delete_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -838,11 +867,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -873,7 +902,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -886,6 +916,7 @@ def begin_delete( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -906,10 +937,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore def _update_initial( self, @@ -926,6 +956,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -936,6 +967,7 @@ def _update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -943,7 +975,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -961,7 +997,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace @@ -1002,8 +1038,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -1017,6 +1054,7 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1041,10 +1079,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore @distributed_trace def list( @@ -1064,7 +1101,7 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -1073,6 +1110,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1086,6 +1125,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, version=version, template_url=self.list.metadata['url'], ) @@ -1099,6 +1139,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, + api_version=api_version, version=version, template_url=next_link, ) @@ -1117,7 +1158,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1130,7 +1175,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore @distributed_trace def list_for_cluster( @@ -1147,7 +1192,7 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. + :param version: Version of the deployments to be listed. Default value is None. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -1156,6 +1201,8 @@ def list_for_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1168,6 +1215,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, version=version, template_url=self.list_for_cluster.metadata['url'], ) @@ -1180,6 +1228,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, version=version, template_url=next_link, ) @@ -1198,7 +1247,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1211,9 +1264,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1227,6 +1280,8 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_start_request_initial( subscription_id=self._config.subscription_id, @@ -1234,12 +1289,17 @@ def _start_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1249,11 +1309,11 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1284,7 +1344,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1297,6 +1358,7 @@ def begin_start( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1317,12 +1379,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - def _stop_initial( + def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1336,6 +1397,8 @@ def _stop_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_stop_request_initial( subscription_id=self._config.subscription_id, @@ -1343,12 +1406,17 @@ def _stop_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1358,11 +1426,11 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore @distributed_trace - def begin_stop( + def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1393,7 +1461,8 @@ def begin_stop( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1406,6 +1475,7 @@ def begin_stop( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1426,12 +1496,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - def _restart_initial( + def _restart_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1445,6 +1514,8 @@ def _restart_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_restart_request_initial( subscription_id=self._config.subscription_id, @@ -1452,12 +1523,17 @@ def _restart_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1467,11 +1543,11 @@ def _restart_initial( if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore @distributed_trace - def begin_restart( + def begin_restart( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1502,7 +1578,8 @@ def begin_restart( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1515,6 +1592,7 @@ def begin_restart( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1535,10 +1613,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore @distributed_trace def get_log_file_url( @@ -1571,6 +1648,8 @@ def get_log_file_url( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_log_file_url_request( subscription_id=self._config.subscription_id, @@ -1578,12 +1657,17 @@ def get_log_file_url( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, template_url=self.get_log_file_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1599,10 +1683,10 @@ def get_log_file_url( return deserialized - get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - def _generate_heap_dump_initial( + def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1617,6 +1701,7 @@ def _generate_heap_dump_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1627,6 +1712,7 @@ def _generate_heap_dump_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_heap_dump_initial.metadata['url'], @@ -1634,7 +1720,11 @@ def _generate_heap_dump_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1644,11 +1734,11 @@ def _generate_heap_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore @distributed_trace - def begin_generate_heap_dump( + def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1683,8 +1773,9 @@ def begin_generate_heap_dump( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1698,6 +1789,7 @@ def begin_generate_heap_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1719,12 +1811,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - def _generate_thread_dump_initial( + def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1739,6 +1830,7 @@ def _generate_thread_dump_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1749,6 +1841,7 @@ def _generate_thread_dump_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_thread_dump_initial.metadata['url'], @@ -1756,7 +1849,11 @@ def _generate_thread_dump_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1766,11 +1863,11 @@ def _generate_thread_dump_initial( if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore @distributed_trace - def begin_generate_thread_dump( + def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1805,8 +1902,9 @@ def begin_generate_thread_dump( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1820,6 +1918,7 @@ def begin_generate_thread_dump( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1841,12 +1940,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - def _start_jfr_initial( + def _start_jfr_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1861,6 +1959,7 @@ def _start_jfr_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1871,6 +1970,7 @@ def _start_jfr_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._start_jfr_initial.metadata['url'], @@ -1878,7 +1978,11 @@ def _start_jfr_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1888,11 +1992,11 @@ def _start_jfr_initial( if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore @distributed_trace - def begin_start_jfr( + def begin_start_jfr( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1927,8 +2031,9 @@ def begin_start_jfr( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1942,6 +2047,7 @@ def begin_start_jfr( app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1963,7 +2069,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py index 1e774b99f10..08db59d600a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -124,10 +125,11 @@ def build_delete_request_initial( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), @@ -136,21 +138,21 @@ def build_delete_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,10 +164,11 @@ def build_list_request( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains") # 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'), @@ -173,21 +176,21 @@ def build_list_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -244,6 +247,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -251,12 +256,17 @@ def get( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,7 +280,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore def _create_or_update_initial( @@ -288,6 +298,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') @@ -298,6 +309,7 @@ def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -305,7 +317,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -323,7 +339,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore @distributed_trace @@ -365,8 +381,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -380,6 +397,7 @@ def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -404,12 +422,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -423,6 +440,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -430,12 +449,17 @@ def _delete_initial( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -445,11 +469,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -480,7 +504,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -493,6 +518,7 @@ def begin_delete( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -513,10 +539,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore @distributed_trace def list( @@ -542,6 +567,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -555,6 +582,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -567,6 +595,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -584,7 +613,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -597,4 +630,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py index 858df5ed1cc..902e344daad 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( route_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), @@ -49,21 +50,21 @@ def build_get_request( "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -79,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), @@ -93,23 +94,23 @@ def build_create_or_update_request_initial( "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -124,10 +125,11 @@ def build_delete_request_initial( route_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), @@ -136,21 +138,21 @@ def build_delete_request_initial( "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,10 +164,11 @@ def build_list_request( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs") # 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'), @@ -173,21 +176,21 @@ def build_list_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -244,6 +247,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -251,12 +256,17 @@ def get( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,7 +280,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore def _create_or_update_initial( @@ -288,6 +298,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') @@ -298,6 +309,7 @@ def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -305,7 +317,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -323,7 +339,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore @distributed_trace @@ -366,8 +382,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -381,6 +398,7 @@ def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -405,12 +423,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -424,6 +441,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -431,12 +450,17 @@ def _delete_initial( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -446,11 +470,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -481,7 +505,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -494,6 +519,7 @@ def begin_delete( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -514,10 +540,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore @distributed_trace def list( @@ -543,6 +568,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -556,6 +583,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -568,6 +596,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -585,7 +614,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -598,4 +631,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py index e4994884358..010df16f444 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), @@ -47,21 +48,21 @@ def build_get_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), @@ -89,23 +90,23 @@ def build_create_or_update_request_initial( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -119,10 +120,11 @@ def build_delete_request_initial( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -194,12 +197,12 @@ def build_validate_domain_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain") # 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'), @@ -207,23 +210,23 @@ def build_validate_domain_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -279,18 +282,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -304,7 +314,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore def _create_or_update_initial( @@ -321,6 +331,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_resource, 'GatewayResource') @@ -330,6 +341,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -337,7 +349,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -355,7 +371,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore @distributed_trace @@ -392,8 +408,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -406,6 +423,7 @@ def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -430,12 +448,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -448,18 +465,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -469,11 +493,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -501,7 +525,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -513,6 +538,7 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -533,10 +559,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore @distributed_trace def list( @@ -559,6 +584,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -571,6 +598,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -582,6 +610,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -599,7 +628,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -612,7 +645,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore @distributed_trace def validate_domain( @@ -646,6 +679,7 @@ def validate_domain( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -655,6 +689,7 @@ def validate_domain( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -662,7 +697,11 @@ def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -676,5 +715,5 @@ def validate_domain( return deserialized - validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py index ad6ebde8e10..a99be97950e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,31 +34,32 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,35 +73,35 @@ def build_update_put_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -116,35 +117,35 @@ def build_update_patch_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -197,17 +198,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -221,7 +229,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore def _update_put_initial( @@ -237,6 +245,7 @@ def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -245,6 +254,7 @@ def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -252,7 +262,11 @@ def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -270,7 +284,7 @@ def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore @distributed_trace @@ -305,8 +319,9 @@ def begin_update_put( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -318,6 +333,7 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -342,10 +358,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore def _update_patch_initial( self, @@ -360,6 +375,7 @@ def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -368,6 +384,7 @@ def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -375,7 +392,11 @@ def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -393,7 +414,7 @@ def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore @distributed_trace @@ -428,8 +449,9 @@ def begin_update_patch( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -441,6 +463,7 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -465,7 +488,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py index 549e2419e09..22e18df017b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -85,6 +86,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -94,6 +97,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -102,6 +106,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -119,7 +124,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,4 +141,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py index 775f5aa2670..108f5a18aef 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -28,24 +28,25 @@ def build_list_runtime_versions_request( **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/runtimeVersions') + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -89,14 +90,21 @@ def list_runtime_versions( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_runtime_versions_request( + api_version=api_version, template_url=self.list_runtime_versions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,5 +118,5 @@ def list_runtime_versions( return deserialized - list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py index afac5b0834e..fd66664a624 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( service_registry_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), @@ -46,21 +47,21 @@ def build_get_request( "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -72,10 +73,11 @@ def build_create_or_update_request_initial( service_registry_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), @@ -83,21 +85,21 @@ def build_create_or_update_request_initial( "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -109,10 +111,11 @@ def build_delete_request_initial( service_registry_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), @@ -120,21 +123,21 @@ def build_delete_request_initial( "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -145,31 +148,32 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -223,18 +227,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -248,7 +259,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore def _create_or_update_initial( @@ -264,18 +275,25 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, template_url=self._create_or_update_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -293,7 +311,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore @distributed_trace @@ -327,7 +345,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,6 +358,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -362,12 +382,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -380,18 +399,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -401,11 +427,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -433,7 +459,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -445,6 +472,7 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -465,10 +493,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore @distributed_trace def list( @@ -491,6 +518,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -503,6 +532,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -514,6 +544,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -531,7 +562,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -544,4 +579,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py index 2b867ca842a..5bb8285dc5f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,31 +35,32 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -73,35 +74,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -114,31 +115,32 @@ def build_delete_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -152,35 +154,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -193,31 +195,32 @@ def build_list_test_keys_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -231,35 +234,35 @@ def build_regenerate_test_key_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -272,31 +275,32 @@ def build_disable_test_endpoint_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -307,31 +311,32 @@ def build_enable_test_endpoint_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -342,31 +347,32 @@ def build_stop_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -377,31 +383,32 @@ def build_start_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -414,34 +421,34 @@ def build_check_name_availability_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "location": _SERIALIZER.url("location", location, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -452,29 +459,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -484,30 +492,31 @@ def build_list_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -558,17 +567,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -582,7 +598,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore def _create_or_update_initial( @@ -598,6 +614,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -606,6 +623,7 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -613,7 +631,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -634,7 +656,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace @@ -668,8 +690,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -681,6 +704,7 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -705,12 +729,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -722,17 +745,24 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -742,11 +772,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -771,7 +801,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -782,6 +813,7 @@ def begin_delete( raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -802,10 +834,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore def _update_initial( self, @@ -820,6 +851,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -828,6 +860,7 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -835,7 +868,11 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -853,7 +890,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace @@ -887,8 +924,9 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -900,6 +938,7 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -924,10 +963,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore @distributed_trace def list_test_keys( @@ -954,17 +992,24 @@ def list_test_keys( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_list_test_keys_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list_test_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -978,7 +1023,7 @@ def list_test_keys( return deserialized - list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore @distributed_trace @@ -1010,6 +1055,7 @@ def regenerate_test_key( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') @@ -1018,6 +1064,7 @@ def regenerate_test_key( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_test_key.metadata['url'], @@ -1025,7 +1072,11 @@ def regenerate_test_key( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1039,11 +1090,11 @@ def regenerate_test_key( return deserialized - regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore @distributed_trace - def disable_test_endpoint( + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1067,17 +1118,24 @@ def disable_test_endpoint( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_disable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.disable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1087,7 +1145,7 @@ def disable_test_endpoint( if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore @distributed_trace @@ -1115,17 +1173,24 @@ def enable_test_endpoint( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_enable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.enable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1139,10 +1204,10 @@ def enable_test_endpoint( return deserialized - enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - def _stop_initial( + def _stop_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1154,17 +1219,24 @@ def _stop_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_stop_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1174,11 +1246,11 @@ def _stop_initial( if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore @distributed_trace - def begin_stop( + def begin_stop( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1203,7 +1275,8 @@ def begin_stop( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1214,6 +1287,7 @@ def begin_stop( raw_result = self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1234,12 +1308,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - def _start_initial( + def _start_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1251,17 +1324,24 @@ def _start_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_start_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1271,11 +1351,11 @@ def _start_initial( if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore @distributed_trace - def begin_start( + def begin_start( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -1300,7 +1380,8 @@ def begin_start( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1311,6 +1392,7 @@ def begin_start( raw_result = self._start_initial( resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1331,10 +1413,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore @distributed_trace def check_name_availability( @@ -1361,6 +1442,7 @@ def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') @@ -1368,6 +1450,7 @@ def check_name_availability( request = build_check_name_availability_request( subscription_id=self._config.subscription_id, location=location, + api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -1375,7 +1458,11 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1389,7 +1476,7 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore @distributed_trace @@ -1405,6 +1492,8 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1415,6 +1504,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -1424,6 +1514,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1441,7 +1532,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1454,7 +1549,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore @distributed_trace def list( @@ -1473,6 +1568,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1484,6 +1581,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -1494,6 +1592,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1511,7 +1610,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1524,4 +1627,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py index 8bfd5f9726e..eac243f1d68 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,29 +30,30 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -92,6 +93,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -102,6 +105,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -111,6 +115,7 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -128,7 +133,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -141,4 +150,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py index d8743b9cea8..bff9a55bc88 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,10 +36,11 @@ def build_get_request( storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), @@ -47,21 +48,21 @@ def build_get_request( "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), @@ -89,23 +90,23 @@ def build_create_or_update_request_initial( "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -119,10 +120,11 @@ def build_delete_request_initial( storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), @@ -130,21 +132,21 @@ def build_delete_request_initial( "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -155,31 +157,32 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-03-01-preview" + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # 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'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -233,18 +236,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -258,7 +268,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore def _create_or_update_initial( @@ -275,6 +285,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(storage_resource, 'StorageResource') @@ -284,6 +295,7 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -291,7 +303,11 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -312,7 +328,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore @distributed_trace @@ -349,8 +365,9 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -363,6 +380,7 @@ def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -387,12 +405,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -405,18 +422,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -426,11 +450,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, service_name: str, @@ -458,7 +482,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -470,6 +495,7 @@ def begin_delete( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -490,10 +516,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore @distributed_trace def list( @@ -516,6 +541,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -528,6 +555,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -539,6 +567,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -556,7 +585,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -569,4 +602,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py new file mode 100644 index 00000000000..41ec6d71ff7 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py new file mode 100644 index 00000000000..f50df2a4890 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py @@ -0,0 +1,153 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes + """REST API for Azure Spring Apps. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2022_04_01.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: azure.mgmt.appplatform.v2022_04_01.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_04_01.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2022_04_01.operations.ServiceRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_04_01.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_04_01.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2022_04_01.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2022_04_01.operations.BindingsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.v2022_04_01.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: azure.mgmt.appplatform.v2022_04_01.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.v2022_04_01.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2022_04_01.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_04_01.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2022_04_01.operations.SkusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AppPlatformManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py new file mode 100644 index 00000000000..c776f7eae7d --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py new file mode 100644 index 00000000000..92453d8691d --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "6.1.0" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py new file mode 100644 index 00000000000..44ce4a5043f --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +__all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py new file mode 100644 index 00000000000..a1b2fd42062 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py @@ -0,0 +1,153 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes + """REST API for Azure Spring Apps. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2022_04_01.aio.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2022_04_01.aio.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_04_01.aio.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2022_04_01.aio.operations.ServiceRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: + azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_04_01.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2022_04_01.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2022_04_01.aio.operations.BindingsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appplatform.v2022_04_01.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2022_04_01.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: azure.mgmt.appplatform.v2022_04_01.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2022_04_01.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_04_01.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2022_04_01.aio.operations.SkusOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AppPlatformManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py new file mode 100644 index 00000000000..55d91609d50 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py new file mode 100644 index 00000000000..152a0c3a076 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._services_operations import ServicesOperations +from ._config_servers_operations import ConfigServersOperations +from ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'ConfigurationServicesOperations', + 'ServiceRegistriesOperations', + 'BuildServiceOperations', + 'BuildpackBindingOperations', + 'BuildServiceBuilderOperations', + 'BuildServiceAgentPoolOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', +] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py new file mode 100644 index 00000000000..32b8e642d9b --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py @@ -0,0 +1,852 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_set_active_deployments_request_initial, build_update_request_initial, build_validate_domain_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppsOperations: + """AppsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + + @distributed_trace_async + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + async def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._set_active_deployments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + + @distributed_trace_async + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py new file mode 100644 index 00000000000..fa1a87d93b4 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py @@ -0,0 +1,606 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BindingsOperations: + """BindingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py new file mode 100644 index 00000000000..44f4ab35cbc --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,346 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_agent_pool_operations import build_get_request, build_list_request, build_update_put_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceAgentPoolOperations: + """BuildServiceAgentPoolOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceAgentPoolResourceCollection"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuildServiceAgentPoolResource"]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py new file mode 100644 index 00000000000..035d3d8564e --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py @@ -0,0 +1,462 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_builder_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceBuilderOperations: + """BuildServiceBuilderOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> "_models.BuilderResource": + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> "_models.BuilderResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuilderResource"]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. + :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuilderResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuilderResourceCollection"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py new file mode 100644 index 00000000000..20a7b61d88b --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py @@ -0,0 +1,985 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_operations import build_create_or_update_build_request, build_get_build_request, build_get_build_result_log_request, build_get_build_result_request, build_get_build_service_request, build_get_resource_upload_url_request, build_get_supported_buildpack_request, build_get_supported_stack_request, build_list_build_results_request, build_list_build_services_request, build_list_builds_request, build_list_supported_buildpacks_request, build_list_supported_stacks_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceOperations: + """BuildServiceOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_build_services( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceCollection"]: + """List build services resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + + @distributed_trace_async + async def get_build_service( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.BuildService": + """Get a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_build_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + + + @distributed_trace + def list_builds( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildCollection"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildCollection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + + @distributed_trace_async + async def get_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> "_models.Build": + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.get_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: "_models.Build", + **kwargs: Any + ) -> "_models.Build": + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build: Parameters for the create or update operation. + :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Build', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace + def list_build_results( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildResultCollection"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildResultCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildResultCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + + @distributed_trace_async + async def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResult": + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + + + @distributed_trace_async + async def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResultLog": + """Get a KPack build result log download URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultLog + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResultLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + + + @distributed_trace_async + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for build service, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace_async + async def list_supported_buildpacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpacksCollection": + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_buildpacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + + + @distributed_trace_async + async def get_supported_buildpack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpackResource": + """Get the supported buildpack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + api_version=api_version, + template_url=self.get_supported_buildpack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + + + @distributed_trace_async + async def list_supported_stacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedStacksCollection": + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_stacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + + + @distributed_trace_async + async def get_supported_stack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any + ) -> "_models.SupportedStackResource": + """Get the supported stack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param stack_name: The name of the stack resource. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + api_version=api_version, + template_url=self.get_supported_stack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py new file mode 100644 index 00000000000..2a82f70139d --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py @@ -0,0 +1,483 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._buildpack_binding_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildpackBindingOperations: + """BuildpackBindingOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuildpackBindingResource"]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Buildpack Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildpackBindingResourceCollection"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py new file mode 100644 index 00000000000..0d13838915e --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py @@ -0,0 +1,444 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CertificateResource"]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py new file mode 100644 index 00000000000..2f3f8835732 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py @@ -0,0 +1,492 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigServersOperations: + """ConfigServersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py new file mode 100644 index 00000000000..4f4501b3c65 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py @@ -0,0 +1,578 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._configuration_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationServicesOperations: + """ConfigurationServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + """Get the Application Configuration Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationServiceResource"]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Application Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationServiceResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> "_models.ConfigurationServiceSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationServiceSettingsValidateResult"]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. + :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + settings=settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..b5eb552c2fe --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py @@ -0,0 +1,606 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomDomainsOperations: + """CustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py new file mode 100644 index 00000000000..391901a14aa --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py @@ -0,0 +1,1504 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + @distributed_trace_async + async def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + + @distributed_trace_async + async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._generate_heap_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + + @distributed_trace_async + async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._generate_thread_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + + + @distributed_trace_async + async def begin_start_jfr( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_jfr_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 00000000000..be988d6a031 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,365 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitoringSettingsOperations: + """MonitoringSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py new file mode 100644 index 00000000000..4fcb09a84df --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..8175b0d2faf --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,93 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RuntimeVersionsOperations: + """RuntimeVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py new file mode 100644 index 00000000000..6e74add2398 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py @@ -0,0 +1,430 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._service_registries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServiceRegistriesOperations: + """ServiceRegistriesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + """Get the Service Registry and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceRegistryResource"]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceRegistryResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py new file mode 100644 index 00000000000..5aa861619df --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py @@ -0,0 +1,925 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations: + """ServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace_async + async def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace_async + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + + @distributed_trace_async + async def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace_async + async def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: + ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py new file mode 100644 index 00000000000..e78d8b07fc1 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py @@ -0,0 +1,118 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SkusOperations: + """SkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceSkuCollection"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py new file mode 100644 index 00000000000..1964396464b --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py @@ -0,0 +1,327 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import ActiveDeploymentCollection +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import Build +from ._models_py3 import BuildCollection +from ._models_py3 import BuildProperties +from ._models_py3 import BuildResult +from ._models_py3 import BuildResultCollection +from ._models_py3 import BuildResultLog +from ._models_py3 import BuildResultProperties +from ._models_py3 import BuildResultUserSourceInfo +from ._models_py3 import BuildService +from ._models_py3 import BuildServiceAgentPoolProperties +from ._models_py3 import BuildServiceAgentPoolResource +from ._models_py3 import BuildServiceAgentPoolResourceCollection +from ._models_py3 import BuildServiceAgentPoolSizeProperties +from ._models_py3 import BuildServiceCollection +from ._models_py3 import BuildServiceProperties +from ._models_py3 import BuildServicePropertiesResourceRequests +from ._models_py3 import BuildStageProperties +from ._models_py3 import BuilderProperties +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceCollection +from ._models_py3 import BuildpackBindingLaunchProperties +from ._models_py3 import BuildpackBindingProperties +from ._models_py3 import BuildpackBindingResource +from ._models_py3 import BuildpackBindingResourceCollection +from ._models_py3 import BuildpackProperties +from ._models_py3 import BuildpacksGroupProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import ConfigurationServiceGitProperty +from ._models_py3 import ConfigurationServiceGitPropertyValidateResult +from ._models_py3 import ConfigurationServiceGitRepository +from ._models_py3 import ConfigurationServiceInstance +from ._models_py3 import ConfigurationServiceProperties +from ._models_py3 import ConfigurationServiceResource +from ._models_py3 import ConfigurationServiceResourceCollection +from ._models_py3 import ConfigurationServiceResourceRequests +from ._models_py3 import ConfigurationServiceSettings +from ._models_py3 import ConfigurationServiceSettingsValidateResult +from ._models_py3 import ContentCertificateProperties +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import DiagnosticParameters +from ._models_py3 import Error +from ._models_py3 import GitPatternRepository +from ._models_py3 import JarUploadedUserSourceInfo +from ._models_py3 import KeyVaultCertificateProperties +from ._models_py3 import LoadedCertificate +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetCoreZipUploadedUserSourceInfo +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceRequests +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import ServiceRegistryInstance +from ._models_py3 import ServiceRegistryProperties +from ._models_py3 import ServiceRegistryResource +from ._models_py3 import ServiceRegistryResourceCollection +from ._models_py3 import ServiceRegistryResourceRequests +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SourceUploadedUserSourceInfo +from ._models_py3 import StackProperties +from ._models_py3 import SupportedBuildpackResource +from ._models_py3 import SupportedBuildpackResourceProperties +from ._models_py3 import SupportedBuildpacksCollection +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import SupportedStackResource +from ._models_py3 import SupportedStackResourceProperties +from ._models_py3 import SupportedStacksCollection +from ._models_py3 import SystemData +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import TriggeredBuildResult +from ._models_py3 import UploadedUserSourceInfo +from ._models_py3 import UserSourceInfo +from ._models_py3 import ValidationMessages + + +from ._app_platform_management_client_enums import ( + ActionType, + AppResourceProvisioningState, + BindingType, + BuildProvisioningState, + BuildResultProvisioningState, + BuildServiceProvisioningState, + BuilderProvisioningState, + BuildpackBindingProvisioningState, + ConfigServerState, + ConfigurationServiceProvisioningState, + CreatedByType, + DeploymentResourceProvisioningState, + DeploymentResourceStatus, + KPackBuildStageProvisioningState, + LastModifiedByType, + ManagedIdentityType, + MonitoringSettingState, + ProvisioningState, + ResourceSkuRestrictionsReasonCode, + ResourceSkuRestrictionsType, + ServiceRegistryProvisioningState, + SkuScaleType, + SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TrafficDirection, +) + +__all__ = [ + 'ActiveDeploymentCollection', + 'AppResource', + 'AppResourceCollection', + 'AppResourceProperties', + 'ApplicationInsightsAgentVersions', + 'AvailableOperations', + 'AvailableRuntimeVersions', + 'BindingResource', + 'BindingResourceCollection', + 'BindingResourceProperties', + 'Build', + 'BuildCollection', + 'BuildProperties', + 'BuildResult', + 'BuildResultCollection', + 'BuildResultLog', + 'BuildResultProperties', + 'BuildResultUserSourceInfo', + 'BuildService', + 'BuildServiceAgentPoolProperties', + 'BuildServiceAgentPoolResource', + 'BuildServiceAgentPoolResourceCollection', + 'BuildServiceAgentPoolSizeProperties', + 'BuildServiceCollection', + 'BuildServiceProperties', + 'BuildServicePropertiesResourceRequests', + 'BuildStageProperties', + 'BuilderProperties', + 'BuilderResource', + 'BuilderResourceCollection', + 'BuildpackBindingLaunchProperties', + 'BuildpackBindingProperties', + 'BuildpackBindingResource', + 'BuildpackBindingResourceCollection', + 'BuildpackProperties', + 'BuildpacksGroupProperties', + 'CertificateProperties', + 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', + 'ClusterResourceProperties', + 'ConfigServerGitProperty', + 'ConfigServerProperties', + 'ConfigServerResource', + 'ConfigServerSettings', + 'ConfigServerSettingsErrorRecord', + 'ConfigServerSettingsValidateResult', + 'ConfigurationServiceGitProperty', + 'ConfigurationServiceGitPropertyValidateResult', + 'ConfigurationServiceGitRepository', + 'ConfigurationServiceInstance', + 'ConfigurationServiceProperties', + 'ConfigurationServiceResource', + 'ConfigurationServiceResourceCollection', + 'ConfigurationServiceResourceRequests', + 'ConfigurationServiceSettings', + 'ConfigurationServiceSettingsValidateResult', + 'ContentCertificateProperties', + 'CustomDomainProperties', + 'CustomDomainResource', + 'CustomDomainResourceCollection', + 'CustomDomainValidatePayload', + 'CustomDomainValidateResult', + 'DeploymentInstance', + 'DeploymentResource', + 'DeploymentResourceCollection', + 'DeploymentResourceProperties', + 'DeploymentSettings', + 'DiagnosticParameters', + 'Error', + 'GitPatternRepository', + 'JarUploadedUserSourceInfo', + 'KeyVaultCertificateProperties', + 'LoadedCertificate', + 'LogFileUrlResponse', + 'LogSpecification', + 'ManagedIdentityProperties', + 'MetricDimension', + 'MetricSpecification', + 'MonitoringSettingProperties', + 'MonitoringSettingResource', + 'NameAvailability', + 'NameAvailabilityParameters', + 'NetCoreZipUploadedUserSourceInfo', + 'NetworkProfile', + 'NetworkProfileOutboundIPs', + 'OperationDetail', + 'OperationDisplay', + 'OperationProperties', + 'PersistentDisk', + 'ProxyResource', + 'RegenerateTestKeyRequestPayload', + 'RequiredTraffic', + 'Resource', + 'ResourceRequests', + 'ResourceSku', + 'ResourceSkuCapabilities', + 'ResourceSkuCollection', + 'ResourceSkuLocationInfo', + 'ResourceSkuRestrictionInfo', + 'ResourceSkuRestrictions', + 'ResourceSkuZoneDetails', + 'ResourceUploadDefinition', + 'ServiceRegistryInstance', + 'ServiceRegistryProperties', + 'ServiceRegistryResource', + 'ServiceRegistryResourceCollection', + 'ServiceRegistryResourceRequests', + 'ServiceResource', + 'ServiceResourceList', + 'ServiceSpecification', + 'Sku', + 'SkuCapacity', + 'SourceUploadedUserSourceInfo', + 'StackProperties', + 'SupportedBuildpackResource', + 'SupportedBuildpackResourceProperties', + 'SupportedBuildpacksCollection', + 'SupportedRuntimeVersion', + 'SupportedStackResource', + 'SupportedStackResourceProperties', + 'SupportedStacksCollection', + 'SystemData', + 'TemporaryDisk', + 'TestKeys', + 'TrackedResource', + 'TriggeredBuildResult', + 'UploadedUserSourceInfo', + 'UserSourceInfo', + 'ValidationMessages', + 'ActionType', + 'AppResourceProvisioningState', + 'BindingType', + 'BuildProvisioningState', + 'BuildResultProvisioningState', + 'BuildServiceProvisioningState', + 'BuilderProvisioningState', + 'BuildpackBindingProvisioningState', + 'ConfigServerState', + 'ConfigurationServiceProvisioningState', + 'CreatedByType', + 'DeploymentResourceProvisioningState', + 'DeploymentResourceStatus', + 'KPackBuildStageProvisioningState', + 'LastModifiedByType', + 'ManagedIdentityType', + 'MonitoringSettingState', + 'ProvisioningState', + 'ResourceSkuRestrictionsReasonCode', + 'ResourceSkuRestrictionsType', + 'ServiceRegistryProvisioningState', + 'SkuScaleType', + 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TrafficDirection', +] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py new file mode 100644 index 00000000000..ac9fe9b1e93 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py @@ -0,0 +1,249 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + +class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Buildpack Binding Type + """ + + APPLICATION_INSIGHTS = "ApplicationInsights" + APACHE_SKY_WALKING = "ApacheSkyWalking" + APP_DYNAMICS = "AppDynamics" + DYNATRACE = "Dynatrace" + NEW_RELIC = "NewRelic" + ELASTIC_APM = "ElasticAPM" + +class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Builder provision status. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Buildpack Binding. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + QUEUING = "Queuing" + BUILDING = "Building" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the config server. + """ + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Application Configuration Service. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Deployment + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Deployment + """ + + STOPPED = "Stopped" + RUNNING = "Running" + +class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of this build stage resource. + """ + + NOT_STARTED = "NotStarted" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that last modified the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the managed identity + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Monitoring Setting. + """ + + NOT_AVAILABLE = "NotAvailable" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Service + """ + + CREATING = "Creating" + UPDATING = "Updating" + STARTING = "Starting" + STOPPING = "Stopping" + DELETING = "Deleting" + DELETED = "Deleted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + MOVED = "Moved" + MOVE_FAILED = "MoveFailed" + +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription' + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the type of restrictions. Possible values include: 'Location', 'Zone' + """ + + LOCATION = "Location" + ZONE = "Zone" + +class ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Service Registry. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the scale. + """ + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + +class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The platform of this runtime version (possible values: "Java" or ".NET"). + """ + + JAVA = "Java" + _NET_CORE = ".NET Core" + +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The raw value which could be passed to deployment CRUD operations. + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + JAVA17 = "Java_17" + NET_CORE31 = "NetCore_31" + +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the test key + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The direction of required traffic + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py new file mode 100644 index 00000000000..44ea53e7708 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py @@ -0,0 +1,5766 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 datetime +from typing import Any, Dict, List, Optional, Union + +import msrest.serialization + +from ._app_platform_management_client_enums import * + + +class ActiveDeploymentCollection(msrest.serialization.Model): + """Object that includes an array of Deployment resource name and set them as active. + + :ivar active_deployment_names: Collection of Deployment name. + :vartype active_deployment_names: list[str] + """ + + _attribute_map = { + 'active_deployment_names': {'key': 'activeDeploymentNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + active_deployment_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword active_deployment_names: Collection of Deployment name. + :paramtype active_deployment_names: list[str] + """ + super(ActiveDeploymentCollection, self).__init__(**kwargs) + self.active_deployment_names = active_deployment_names + + +class ApplicationInsightsAgentVersions(msrest.serialization.Model): + """Application Insights agent versions properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar java: Indicates the version of application insight java agent. + :vartype java: str + """ + + _validation = { + 'java': {'readonly': True}, + } + + _attribute_map = { + 'java': {'key': 'java', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) + self.java = None + + +class Resource(msrest.serialization.Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class AppResource(ProxyResource): + """App resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'AppResourceProperties'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentityProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["AppResourceProperties"] = None, + identity: Optional["ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ + super(AppResource, self).__init__(**kwargs) + self.properties = properties + self.identity = identity + self.location = location + + +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AppResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(AppResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(msrest.serialization.Model): + """App resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool + :ivar url: URL of the App. + :vartype url: str + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProvisioningState + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2022_04_01.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_04_01.models.PersistentDisk + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool + :ivar loaded_certificates: Collection of loaded certificates. + :vartype loaded_certificates: + list[~azure.mgmt.appplatform.v2022_04_01.models.LoadedCertificate] + """ + + _validation = { + 'url': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'temporary_disk': {'key': 'temporaryDisk', 'type': 'TemporaryDisk'}, + 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, + 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, + 'loaded_certificates': {'key': 'loadedCertificates', 'type': '[LoadedCertificate]'}, + } + + def __init__( + self, + *, + public: Optional[bool] = None, + addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, + fqdn: Optional[str] = None, + https_only: Optional[bool] = False, + temporary_disk: Optional["TemporaryDisk"] = None, + persistent_disk: Optional["PersistentDisk"] = None, + enable_end_to_end_tls: Optional[bool] = False, + loaded_certificates: Optional[List["LoadedCertificate"]] = None, + **kwargs + ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2022_04_01.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_04_01.models.PersistentDisk + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + :keyword loaded_certificates: Collection of loaded certificates. + :paramtype loaded_certificates: + list[~azure.mgmt.appplatform.v2022_04_01.models.LoadedCertificate] + """ + super(AppResourceProperties, self).__init__(**kwargs) + self.public = public + self.url = None + self.addon_configs = addon_configs + self.provisioning_state = None + self.fqdn = fqdn + self.https_only = https_only + self.temporary_disk = temporary_disk + self.persistent_disk = persistent_disk + self.enable_end_to_end_tls = enable_end_to_end_tls + self.loaded_certificates = loaded_certificates + + +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDetail"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(AvailableOperations, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(msrest.serialization.Model): + """AvailableRuntimeVersions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of all supported runtime versions. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeVersion] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AvailableRuntimeVersions, self).__init__(**kwargs) + self.value = None + + +class BindingResource(ProxyResource): + """Binding resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the Binding resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceProperties + """ + + _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': 'BindingResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BindingResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceProperties + """ + super(BindingResource, self).__init__(**kwargs) + self.properties = properties + + +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(msrest.serialization.Model): + """Binding resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_name: The name of the bound resource. + :vartype resource_name: str + :ivar resource_type: The standard Azure resource type of the bound resource. + :vartype resource_type: str + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. + :vartype generated_properties: str + :ivar created_at: Creation time of the Binding resource. + :vartype created_at: str + :ivar updated_at: Update time of the Binding resource. + :vartype updated_at: str + """ + + _validation = { + 'resource_name': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'generated_properties': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'binding_parameters': {'key': 'bindingParameters', 'type': '{object}'}, + 'generated_properties': {'key': 'generatedProperties', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'updated_at': {'key': 'updatedAt', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, Any]] = None, + **kwargs + ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ + super(BindingResourceProperties, self).__init__(**kwargs) + self.resource_name = None + self.resource_type = None + self.resource_id = resource_id + self.key = key + self.binding_parameters = binding_parameters + self.generated_properties = None + self.created_at = None + self.updated_at = None + + +class Build(ProxyResource): + """Build resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildProperties + """ + + _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': 'BuildProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildProperties + """ + super(Build, self).__init__(**kwargs) + self.properties = properties + + +class BuildCollection(msrest.serialization.Model): + """Object that includes an array of Build resources and a possible link for next set. + + :ivar value: Collection of Build resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.Build] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Build]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Build"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.Build] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuilderProperties(msrest.serialization.Model): + """KPack Builder properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Builder provision status. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProvisioningState + :ivar stack: Builder cluster stack property. + :vartype stack: ~azure.mgmt.appplatform.v2022_04_01.models.StackProperties + :ivar buildpack_groups: Builder buildpack groups. + :vartype buildpack_groups: + list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpacksGroupProperties] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stack': {'key': 'stack', 'type': 'StackProperties'}, + 'buildpack_groups': {'key': 'buildpackGroups', 'type': '[BuildpacksGroupProperties]'}, + } + + def __init__( + self, + *, + stack: Optional["StackProperties"] = None, + buildpack_groups: Optional[List["BuildpacksGroupProperties"]] = None, + **kwargs + ): + """ + :keyword stack: Builder cluster stack property. + :paramtype stack: ~azure.mgmt.appplatform.v2022_04_01.models.StackProperties + :keyword buildpack_groups: Builder buildpack groups. + :paramtype buildpack_groups: + list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpacksGroupProperties] + """ + super(BuilderProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.stack = stack + self.buildpack_groups = buildpack_groups + + +class BuilderResource(ProxyResource): + """KPack Builder 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Property of the Builder resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProperties + """ + + _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': 'BuilderProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuilderProperties"] = None, + **kwargs + ): + """ + :keyword properties: Property of the Builder resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProperties + """ + super(BuilderResource, self).__init__(**kwargs) + self.properties = properties + + +class BuilderResourceCollection(msrest.serialization.Model): + """Object that includes an array of Builder resources and a possible link for next set. + + :ivar value: Collection of Builder resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuilderResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuilderResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Builder resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuilderResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackBindingLaunchProperties(msrest.serialization.Model): + """Buildpack Binding Launch Properties. + + :ivar properties: Non-sensitive properties for launchProperties. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties for launchProperties. + :vartype secrets: dict[str, str] + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'secrets': {'key': 'secrets', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + secrets: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword properties: Non-sensitive properties for launchProperties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for launchProperties. + :paramtype secrets: dict[str, str] + """ + super(BuildpackBindingLaunchProperties, self).__init__(**kwargs) + self.properties = properties + self.secrets = secrets + + +class BuildpackBindingProperties(msrest.serialization.Model): + """Properties of a buildpack binding. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". + :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.BindingType + :ivar provisioning_state: State of the Buildpack Binding. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProvisioningState + :ivar launch_properties: The object describes the buildpack binding launch properties. + :vartype launch_properties: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingLaunchProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'binding_type': {'key': 'bindingType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'launch_properties': {'key': 'launchProperties', 'type': 'BuildpackBindingLaunchProperties'}, + } + + def __init__( + self, + *, + binding_type: Optional[Union[str, "BindingType"]] = None, + launch_properties: Optional["BuildpackBindingLaunchProperties"] = None, + **kwargs + ): + """ + :keyword binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". + :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.BindingType + :keyword launch_properties: The object describes the buildpack binding launch properties. + :paramtype launch_properties: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingLaunchProperties + """ + super(BuildpackBindingProperties, self).__init__(**kwargs) + self.binding_type = binding_type + self.provisioning_state = None + self.launch_properties = launch_properties + + +class BuildpackBindingResource(ProxyResource): + """Buildpack Binding Resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of a buildpack binding. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProperties + """ + + _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': 'BuildpackBindingProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildpackBindingProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of a buildpack binding. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProperties + """ + super(BuildpackBindingResource, self).__init__(**kwargs) + self.properties = properties + + +class BuildpackBindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of BuildpackBinding resources and a possible link for next set. + + :ivar value: Collection of BuildpackBinding resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildpackBindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildpackBindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of BuildpackBinding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildpackBindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackProperties(msrest.serialization.Model): + """Buildpack properties payload. + + :ivar id: Id of the buildpack. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Id of the buildpack. + :paramtype id: str + """ + super(BuildpackProperties, self).__init__(**kwargs) + self.id = id + + +class BuildpacksGroupProperties(msrest.serialization.Model): + """Buildpack group properties of the Builder. + + :ivar name: Buildpack group name. + :vartype name: str + :ivar buildpacks: Buildpacks in the buildpack group. + :vartype buildpacks: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackProperties] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'buildpacks': {'key': 'buildpacks', 'type': '[BuildpackProperties]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + buildpacks: Optional[List["BuildpackProperties"]] = None, + **kwargs + ): + """ + :keyword name: Buildpack group name. + :paramtype name: str + :keyword buildpacks: Buildpacks in the buildpack group. + :paramtype buildpacks: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackProperties] + """ + super(BuildpacksGroupProperties, self).__init__(**kwargs) + self.name = name + self.buildpacks = buildpacks + + +class BuildProperties(msrest.serialization.Model): + """Build resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar relative_path: The relative path of source code. + :vartype relative_path: str + :ivar builder: The resource id of builder to build the source code. + :vartype builder: str + :ivar agent_pool: The resource id of agent pool. + :vartype agent_pool: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.BuildProvisioningState + :ivar env: The environment variables for this build. + :vartype env: dict[str, str] + :ivar triggered_build_result: The build result triggered by this build. + :vartype triggered_build_result: + ~azure.mgmt.appplatform.v2022_04_01.models.TriggeredBuildResult + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'triggered_build_result': {'readonly': True}, + } + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'builder': {'key': 'builder', 'type': 'str'}, + 'agent_pool': {'key': 'agentPool', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'env': {'key': 'env', 'type': '{str}'}, + 'triggered_build_result': {'key': 'triggeredBuildResult', 'type': 'TriggeredBuildResult'}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + builder: Optional[str] = None, + agent_pool: Optional[str] = None, + env: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword relative_path: The relative path of source code. + :paramtype relative_path: str + :keyword builder: The resource id of builder to build the source code. + :paramtype builder: str + :keyword agent_pool: The resource id of agent pool. + :paramtype agent_pool: str + :keyword env: The environment variables for this build. + :paramtype env: dict[str, str] + """ + super(BuildProperties, self).__init__(**kwargs) + self.relative_path = relative_path + self.builder = builder + self.agent_pool = agent_pool + self.provisioning_state = None + self.env = env + self.triggered_build_result = None + + +class BuildResult(ProxyResource): + """Build result resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the build result resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultProperties + """ + + _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': 'BuildResultProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildResultProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build result resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultProperties + """ + super(BuildResult, self).__init__(**kwargs) + self.properties = properties + + +class BuildResultCollection(msrest.serialization.Model): + """Object that includes an array of Build result resources and a possible link for next set. + + :ivar value: Collection of Build result resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildResult] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildResult"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build result resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildResult] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildResultCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildResultLog(msrest.serialization.Model): + """Build result log resource properties payload. + + :ivar blob_url: The public download URL of this build result log. + :vartype blob_url: str + """ + + _attribute_map = { + 'blob_url': {'key': 'blobUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + blob_url: Optional[str] = None, + **kwargs + ): + """ + :keyword blob_url: The public download URL of this build result log. + :paramtype blob_url: str + """ + super(BuildResultLog, self).__init__(**kwargs) + self.blob_url = blob_url + + +class BuildResultProperties(msrest.serialization.Model): + """Build result resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build result. + :vartype name: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Queuing", "Building", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultProvisioningState + :ivar build_pod_name: The build pod name which can be used to get the build log streaming. + :vartype build_pod_name: str + :ivar build_stages: All of the build stage (init-container and container) resources in build + pod. + :vartype build_stages: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildStageProperties] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'build_stages': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'build_pod_name': {'key': 'buildPodName', 'type': 'str'}, + 'build_stages': {'key': 'buildStages', 'type': '[BuildStageProperties]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + build_pod_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of this build result. + :paramtype name: str + :keyword build_pod_name: The build pod name which can be used to get the build log streaming. + :paramtype build_pod_name: str + """ + super(BuildResultProperties, self).__init__(**kwargs) + self.name = name + self.provisioning_state = None + self.build_pod_name = build_pod_name + self.build_stages = None + + +class UserSourceInfo(msrest.serialization.Model): + """Source information for a deployment. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BuildResultUserSourceInfo, UploadedUserSourceInfo. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'BuildResult': 'BuildResultUserSourceInfo', 'UploadedUserSourceInfo': 'UploadedUserSourceInfo'} + } + + def __init__( + self, + *, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + """ + super(UserSourceInfo, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.version = version + + +class BuildResultUserSourceInfo(UserSourceInfo): + """Reference to a build result. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring + instance. + :vartype build_result_id: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'build_result_id': {'key': 'buildResultId', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + build_result_id: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword build_result_id: Resource id of an existing succeeded build result under the same + Spring instance. + :paramtype build_result_id: str + """ + super(BuildResultUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'BuildResult' # type: str + self.build_result_id = build_result_id + + +class BuildService(ProxyResource): + """Build service resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProperties + """ + + _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': 'BuildServiceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildServiceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProperties + """ + super(BuildService, self).__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolProperties(msrest.serialization.Model): + """Build service agent pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the build service agent pool. + :vartype provisioning_state: str + :ivar pool_size: build service agent pool size properties. + :vartype pool_size: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolSizeProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'pool_size': {'key': 'poolSize', 'type': 'BuildServiceAgentPoolSizeProperties'}, + } + + def __init__( + self, + *, + pool_size: Optional["BuildServiceAgentPoolSizeProperties"] = None, + **kwargs + ): + """ + :keyword pool_size: build service agent pool size properties. + :paramtype pool_size: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolSizeProperties + """ + super(BuildServiceAgentPoolProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.pool_size = pool_size + + +class BuildServiceAgentPoolResource(ProxyResource): + """The build service agent pool 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: build service agent pool properties. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolProperties + """ + + _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': 'BuildServiceAgentPoolProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildServiceAgentPoolProperties"] = None, + **kwargs + ): + """ + :keyword properties: build service agent pool properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolProperties + """ + super(BuildServiceAgentPoolResource, self).__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolResourceCollection(msrest.serialization.Model): + """Object that includes an array of build service agent pool resources and a possible link for next set. + + :ivar value: Collection of build service agent pool resource. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildServiceAgentPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildServiceAgentPoolResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of build service agent pool resource. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildServiceAgentPoolResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceAgentPoolSizeProperties(msrest.serialization.Model): + """Build service agent pool size properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of build service agent pool size. + :vartype name: str + :ivar cpu: The cpu property of build service agent pool size. + :vartype cpu: str + :ivar memory: The memory property of build service agent pool size. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of build service agent pool size. + :paramtype name: str + """ + super(BuildServiceAgentPoolSizeProperties, self).__init__(**kwargs) + self.name = name + self.cpu = None + self.memory = None + + +class BuildServiceCollection(msrest.serialization.Model): + """Object that includes an array of Build service resources and a possible link for next set. + + :ivar value: Collection of Build service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildService] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildService"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildService] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildServiceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceProperties(msrest.serialization.Model): + """Build service resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar k_pack_version: The installed KPack version in this build service. + :vartype k_pack_version: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProvisioningState + :ivar resource_requests: The runtime resource configuration of this build service. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServicePropertiesResourceRequests + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'k_pack_version': {'key': 'kPackVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'BuildServicePropertiesResourceRequests'}, + } + + def __init__( + self, + *, + k_pack_version: Optional[str] = None, + resource_requests: Optional["BuildServicePropertiesResourceRequests"] = None, + **kwargs + ): + """ + :keyword k_pack_version: The installed KPack version in this build service. + :paramtype k_pack_version: str + :keyword resource_requests: The runtime resource configuration of this build service. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServicePropertiesResourceRequests + """ + super(BuildServiceProperties, self).__init__(**kwargs) + self.k_pack_version = k_pack_version + self.provisioning_state = None + self.resource_requests = resource_requests + + +class BuildServicePropertiesResourceRequests(msrest.serialization.Model): + """The runtime resource configuration of this build service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: vCPU allocated to the entire build service node pool. + :vartype cpu: str + :ivar memory: Memory allocated to the entire build service node pool. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BuildServicePropertiesResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + + +class BuildStageProperties(msrest.serialization.Model): + """The build stage (init-container and container) resources in build pod. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build stage resource. + :vartype name: str + :ivar status: The provisioning state of this build stage resource. Possible values include: + "NotStarted", "Running", "Succeeded", "Failed". + :vartype status: str or + ~azure.mgmt.appplatform.v2022_04_01.models.KPackBuildStageProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BuildStageProperties, self).__init__(**kwargs) + self.name = None + self.status = None + + +class CertificateProperties(msrest.serialization.Model): + """Certificate resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContentCertificateProperties, KeyVaultCertificateProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + } + + _subtype_map = { + 'type': {'ContentCertificate': 'ContentCertificateProperties', 'KeyVaultCertificate': 'KeyVaultCertificateProperties'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CertificateProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.thumbprint = None + self.issuer = None + self.issued_date = None + self.expiration_date = None + self.activate_date = None + self.subject_name = None + self.dns_names = None + + +class CertificateResource(ProxyResource): + """Certificate resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateProperties + """ + + _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': 'CertificateProperties'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateProperties + """ + super(CertificateResource, self).__init__(**kwargs) + self.properties = properties + + +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. + + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2022_04_01.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2022_04_01.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ClusterResourceProperties(msrest.serialization.Model): + """Service properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", + "Moving", "Moved", "MoveFailed". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.ProvisioningState + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfile + :ivar version: Version of the Service. + :vartype version: int + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. + :vartype service_id: str + :ivar zone_redundant: + :vartype zone_redundant: bool + :ivar fqdn: Fully qualified dns name of the service instance. + :vartype fqdn: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version': {'readonly': True}, + 'service_id': {'readonly': True}, + 'fqdn': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfile'}, + 'version': {'key': 'version', 'type': 'int'}, + 'service_id': {'key': 'serviceId', 'type': 'str'}, + 'zone_redundant': {'key': 'zoneRedundant', 'type': 'bool'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + } + + def __init__( + self, + *, + network_profile: Optional["NetworkProfile"] = None, + zone_redundant: Optional[bool] = False, + **kwargs + ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfile + :keyword zone_redundant: + :paramtype zone_redundant: bool + """ + super(ClusterResourceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.network_profile = network_profile + self.version = None + self.service_id = None + self.zone_redundant = zone_redundant + self.fqdn = None + + +class ConfigServerGitProperty(msrest.serialization.Model): + """Property of git. + + All required parameters must be populated in order to send to Azure. + + :ivar repositories: Repositories of git. + :vartype repositories: list[~azure.mgmt.appplatform.v2022_04_01.models.GitPatternRepository] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'repositories': {'key': 'repositories', 'type': '[GitPatternRepository]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + *, + uri: str, + repositories: Optional[List["GitPatternRepository"]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: list[~azure.mgmt.appplatform.v2022_04_01.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(ConfigServerGitProperty, self).__init__(**kwargs) + self.repositories = repositories + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class ConfigServerProperties(msrest.serialization.Model): + """Config server git properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerState + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, + } + + def __init__( + self, + *, + error: Optional["Error"] = None, + config_server: Optional["ConfigServerSettings"] = None, + **kwargs + ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings + """ + super(ConfigServerProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.config_server = config_server + + +class ConfigServerResource(ProxyResource): + """Config Server 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerProperties + """ + + _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': 'ConfigServerProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ConfigServerProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerProperties + """ + super(ConfigServerResource, self).__init__(**kwargs) + self.properties = properties + + +class ConfigServerSettings(msrest.serialization.Model): + """The settings of config server. + + :ivar git_property: Property of git environment. + :vartype git_property: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerGitProperty + """ + + _attribute_map = { + 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, + } + + def __init__( + self, + *, + git_property: Optional["ConfigServerGitProperty"] = None, + **kwargs + ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerGitProperty + """ + super(ConfigServerSettings, self).__init__(**kwargs) + self.git_property = git_property + + +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): + """Error record of the config server settings. + + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'messages': {'key': 'messages', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + uri: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ + super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) + self.name = name + self.uri = uri + self.messages = messages + + +class ConfigServerSettingsValidateResult(msrest.serialization.Model): + """Validation result for config server settings. + + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsErrorRecord] + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, + **kwargs + ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsErrorRecord] + """ + super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.details = details + + +class ConfigurationServiceGitProperty(msrest.serialization.Model): + """Property of git environment. + + :ivar repositories: Repositories of Application Configuration Service git property. + :vartype repositories: + list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitRepository] + """ + + _attribute_map = { + 'repositories': {'key': 'repositories', 'type': '[ConfigurationServiceGitRepository]'}, + } + + def __init__( + self, + *, + repositories: Optional[List["ConfigurationServiceGitRepository"]] = None, + **kwargs + ): + """ + :keyword repositories: Repositories of Application Configuration Service git property. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitRepository] + """ + super(ConfigurationServiceGitProperty, self).__init__(**kwargs) + self.repositories = repositories + + +class ConfigurationServiceGitPropertyValidateResult(msrest.serialization.Model): + """Validation result for configuration service settings. + + :ivar is_valid: Indicate if the configuration service settings are valid. + :vartype is_valid: bool + :ivar git_repos_validation_result: The detail validation results. + :vartype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2022_04_01.models.ValidationMessages] + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'git_repos_validation_result': {'key': 'gitReposValidationResult', 'type': '[ValidationMessages]'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + git_repos_validation_result: Optional[List["ValidationMessages"]] = None, + **kwargs + ): + """ + :keyword is_valid: Indicate if the configuration service settings are valid. + :paramtype is_valid: bool + :keyword git_repos_validation_result: The detail validation results. + :paramtype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2022_04_01.models.ValidationMessages] + """ + super(ConfigurationServiceGitPropertyValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.git_repos_validation_result = git_repos_validation_result + + +class ConfigurationServiceGitRepository(msrest.serialization.Model): + """Git repository property payload for Application Configuration Service. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar patterns: Required. Collection of patterns of the repository. + :vartype patterns: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Required. Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'name': {'required': True}, + 'patterns': {'required': True}, + 'uri': {'required': True}, + 'label': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'patterns': {'key': 'patterns', 'type': '[str]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + patterns: List[str], + uri: str, + label: str, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword patterns: Required. Collection of patterns of the repository. + :paramtype patterns: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Required. Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(ConfigurationServiceGitRepository, self).__init__(**kwargs) + self.name = name + self.patterns = patterns + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class ConfigurationServiceInstance(msrest.serialization.Model): + """Collection of instances belong to the Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Configuration Service instance. + :vartype name: str + :ivar status: Status of the Application Configuration Service instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConfigurationServiceInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ConfigurationServiceProperties(msrest.serialization.Model): + """Application Configuration Service properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Application Configuration Service. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResourceRequests + :ivar instances: Collection of instances belong to Application Configuration Service. + :vartype instances: + list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceInstance] + :ivar settings: The settings of Application Configuration Service. + :vartype settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ConfigurationServiceResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ConfigurationServiceInstance]'}, + 'settings': {'key': 'settings', 'type': 'ConfigurationServiceSettings'}, + } + + def __init__( + self, + *, + settings: Optional["ConfigurationServiceSettings"] = None, + **kwargs + ): + """ + :keyword settings: The settings of Application Configuration Service. + :paramtype settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings + """ + super(ConfigurationServiceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.resource_requests = None + self.instances = None + self.settings = settings + + +class ConfigurationServiceResource(ProxyResource): + """Application Configuration Service 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Application Configuration Service properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProperties + """ + + _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': 'ConfigurationServiceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ConfigurationServiceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Application Configuration Service properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProperties + """ + super(ConfigurationServiceResource, self).__init__(**kwargs) + self.properties = properties + + +class ConfigurationServiceResourceCollection(msrest.serialization.Model): + """Object that includes an array of configuration service resources and a possible link for next set. + + :ivar value: Collection of configuration service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConfigurationServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of configuration service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ConfigurationServiceResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConfigurationServiceResourceRequests(msrest.serialization.Model): + """Resource request payload of Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Application Configuration Service instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Application Configuration Service instance. + :vartype memory: str + :ivar instance_count: Instance count of the Application Configuration Service. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConfigurationServiceResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class ConfigurationServiceSettings(msrest.serialization.Model): + """The settings of Application Configuration Service. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitProperty + """ + + _attribute_map = { + 'git_property': {'key': 'gitProperty', 'type': 'ConfigurationServiceGitProperty'}, + } + + def __init__( + self, + *, + git_property: Optional["ConfigurationServiceGitProperty"] = None, + **kwargs + ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitProperty + """ + super(ConfigurationServiceSettings, self).__init__(**kwargs) + self.git_property = git_property + + +class ConfigurationServiceSettingsValidateResult(msrest.serialization.Model): + """Validation result for configuration service settings. + + :ivar git_property_validation_result: Validation result for configuration service settings. + :vartype git_property_validation_result: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitPropertyValidateResult + """ + + _attribute_map = { + 'git_property_validation_result': {'key': 'gitPropertyValidationResult', 'type': 'ConfigurationServiceGitPropertyValidateResult'}, + } + + def __init__( + self, + *, + git_property_validation_result: Optional["ConfigurationServiceGitPropertyValidateResult"] = None, + **kwargs + ): + """ + :keyword git_property_validation_result: Validation result for configuration service settings. + :paramtype git_property_validation_result: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitPropertyValidateResult + """ + super(ConfigurationServiceSettingsValidateResult, self).__init__(**kwargs) + self.git_property_validation_result = git_property_validation_result + + +class ContentCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar content: The content of uploaded certificate. + :vartype content: str + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'content': {'key': 'content', 'type': 'str'}, + } + + def __init__( + self, + *, + content: Optional[str] = None, + **kwargs + ): + """ + :keyword content: The content of uploaded certificate. + :paramtype content: str + """ + super(ContentCertificateProperties, self).__init__(**kwargs) + self.type = 'ContentCertificate' # type: str + self.content = content + + +class CustomDomainProperties(msrest.serialization.Model): + """Custom domain of app resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + :ivar app_name: The app name of domain. + :vartype app_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str + """ + + _validation = { + 'app_name': {'readonly': True}, + } + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'app_name': {'key': 'appName', 'type': 'str'}, + 'cert_name': {'key': 'certName', 'type': 'str'}, + } + + def __init__( + self, + *, + thumbprint: Optional[str] = None, + cert_name: Optional[str] = None, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ + super(CustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = thumbprint + self.app_name = None + self.cert_name = cert_name + + +class CustomDomainResource(ProxyResource): + """Custom domain resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainProperties + """ + + _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': 'CustomDomainProperties'}, + } + + def __init__( + self, + *, + properties: Optional["CustomDomainProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainProperties + """ + super(CustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(msrest.serialization.Model): + """Custom domain validate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name to be validated. + :vartype name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ + super(CustomDomainValidatePayload, self).__init__(**kwargs) + self.name = name + + +class CustomDomainValidateResult(msrest.serialization.Model): + """Validation result for custom domain. + + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ + super(CustomDomainValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.message = message + + +class DeploymentInstance(msrest.serialization.Model): + """Deployment instance payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the deployment instance. + :vartype name: str + :ivar status: Status of the deployment instance. + :vartype status: str + :ivar reason: Failed reason of the deployment instance. + :vartype reason: str + :ivar discovery_status: Discovery status of the deployment instance. + :vartype discovery_status: str + :ivar start_time: Start time of the deployment instance. + :vartype start_time: str + :ivar zone: Availability zone information of the deployment instance. + :vartype zone: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'reason': {'readonly': True}, + 'discovery_status': {'readonly': True}, + 'start_time': {'readonly': True}, + 'zone': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'zone': {'key': 'zone', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeploymentInstance, self).__init__(**kwargs) + self.name = None + self.status = None + self.reason = None + self.discovery_status = None + self.start_time = None + self.zone = None + + +class DeploymentResource(ProxyResource): + """Deployment resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the Deployment resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku + """ + + _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': 'DeploymentResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku + """ + super(DeploymentResource, self).__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(msrest.serialization.Model): + """Deployment resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2022_04_01.models.UserSourceInfo + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentSettings + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProvisioningState + :ivar status: Status of the Deployment. Possible values include: "Stopped", "Running". + :vartype status: str or ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceStatus + :ivar active: Indicates whether the Deployment is active. + :vartype active: bool + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'UserSourceInfo'}, + 'deployment_settings': {'key': 'deploymentSettings', 'type': 'DeploymentSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'active': {'key': 'active', 'type': 'bool'}, + 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, + } + + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + active: Optional[bool] = None, + **kwargs + ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2022_04_01.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentSettings + :keyword active: Indicates whether the Deployment is active. + :paramtype active: bool + """ + super(DeploymentResourceProperties, self).__init__(**kwargs) + self.source = source + self.deployment_settings = deployment_settings + self.provisioning_state = None + self.status = None + self.active = active + self.instances = None + + +class DeploymentSettings(msrest.serialization.Model): + """Deployment settings payload. + + :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :vartype resource_requests: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceRequests + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] + """ + + _attribute_map = { + 'resource_requests': {'key': 'resourceRequests', 'type': 'ResourceRequests'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, + } + + def __init__( + self, + *, + resource_requests: Optional["ResourceRequests"] = None, + environment_variables: Optional[Dict[str, str]] = None, + addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, + **kwargs + ): + """ + :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :paramtype resource_requests: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceRequests + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + """ + super(DeploymentSettings, self).__init__(**kwargs) + self.resource_requests = resource_requests + self.environment_variables = environment_variables + self.addon_configs = addon_configs + + +class DiagnosticParameters(msrest.serialization.Model): + """Diagnostic parameters of diagnostic operations. + + :ivar app_instance: App instance name. + :vartype app_instance: str + :ivar file_path: Your target file path in your own BYOS. + :vartype file_path: str + :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :vartype duration: str + """ + + _attribute_map = { + 'app_instance': {'key': 'appInstance', 'type': 'str'}, + 'file_path': {'key': 'filePath', 'type': 'str'}, + 'duration': {'key': 'duration', 'type': 'str'}, + } + + def __init__( + self, + *, + app_instance: Optional[str] = None, + file_path: Optional[str] = None, + duration: Optional[str] = None, + **kwargs + ): + """ + :keyword app_instance: App instance name. + :paramtype app_instance: str + :keyword file_path: Your target file path in your own BYOS. + :paramtype file_path: str + :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :paramtype duration: str + """ + super(DiagnosticParameters, self).__init__(**kwargs) + self.app_instance = app_instance + self.file_path = file_path + self.duration = duration + + +class Error(msrest.serialization.Model): + """The error code compose of code and message. + + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + + +class GitPatternRepository(msrest.serialization.Model): + """Git repository property payload for config server. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'name': {'required': True}, + 'uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'pattern': {'key': 'pattern', 'type': '[str]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + uri: str, + pattern: Optional[List[str]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(GitPatternRepository, self).__init__(**kwargs) + self.name = name + self.pattern = pattern + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class UploadedUserSourceInfo(UserSourceInfo): + """Source with uploaded location. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: JarUploadedUserSourceInfo, NetCoreZipUploadedUserSourceInfo, SourceUploadedUserSourceInfo. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Jar': 'JarUploadedUserSourceInfo', 'NetCoreZip': 'NetCoreZipUploadedUserSourceInfo', 'Source': 'SourceUploadedUserSourceInfo'} + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + """ + super(UploadedUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'UploadedUserSourceInfo' # type: str + self.relative_path = relative_path + + +class JarUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar runtime_version: Runtime version of the Jar file. + :vartype runtime_version: str + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + runtime_version: Optional[str] = None, + jvm_options: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword runtime_version: Runtime version of the Jar file. + :paramtype runtime_version: str + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + """ + super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'Jar' # type: str + self.runtime_version = runtime_version + self.jvm_options = jvm_options + + +class KeyVaultCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str + :ivar exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :vartype exclude_private_key: bool + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'vault_uri': {'required': True}, + 'key_vault_cert_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, + 'cert_version': {'key': 'certVersion', 'type': 'str'}, + 'exclude_private_key': {'key': 'excludePrivateKey', 'type': 'bool'}, + } + + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + exclude_private_key: Optional[bool] = False, + **kwargs + ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + :keyword exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :paramtype exclude_private_key: bool + """ + super(KeyVaultCertificateProperties, self).__init__(**kwargs) + self.type = 'KeyVaultCertificate' # type: str + self.vault_uri = vault_uri + self.key_vault_cert_name = key_vault_cert_name + self.cert_version = cert_version + self.exclude_private_key = exclude_private_key + + +class LoadedCertificate(msrest.serialization.Model): + """Loaded certificate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: Required. Resource Id of loaded certificate. + :vartype resource_id: str + :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :vartype load_trust_store: bool + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'load_trust_store': {'key': 'loadTrustStore', 'type': 'bool'}, + } + + def __init__( + self, + *, + resource_id: str, + load_trust_store: Optional[bool] = False, + **kwargs + ): + """ + :keyword resource_id: Required. Resource Id of loaded certificate. + :paramtype resource_id: str + :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :paramtype load_trust_store: bool + """ + super(LoadedCertificate, self).__init__(**kwargs) + self.resource_id = resource_id + self.load_trust_store = load_trust_store + + +class LogFileUrlResponse(msrest.serialization.Model): + """Log file URL payload. + + All required parameters must be populated in order to send to Azure. + + :ivar url: Required. URL of the log file. + :vartype url: str + """ + + _validation = { + 'url': {'required': True}, + } + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + *, + url: str, + **kwargs + ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ + super(LogFileUrlResponse, self).__init__(**kwargs) + self.url = url + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedIdentityProperties(msrest.serialization.Model): + """Managed identity properties retrieved from ARM request headers. + + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityType + :ivar principal_id: Principal Id of system-assigned managed identity. + :vartype principal_id: str + :ivar tenant_id: Tenant Id of system-assigned managed identity. + :vartype tenant_id: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs + ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityType + :keyword principal_id: Principal Id of system-assigned managed identity. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id of system-assigned managed identity. + :paramtype tenant_id: str + """ + super(ManagedIdentityProperties, self).__init__(**kwargs) + self.type = type + self.principal_id = principal_id + self.tenant_id = tenant_id + + +class MetricDimension(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :vartype to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ + super(MetricDimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class MetricSpecification(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2022_04_01.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["MetricDimension"]] = None, + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2022_04_01.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.category = category + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.fill_gap_with_zero = fill_gap_with_zero + self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace + + +class MonitoringSettingProperties(msrest.serialization.Model): + """Monitoring Setting properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingState + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated + since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate + if monitoringSettings enabled or not. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2022_04_01.models.ApplicationInsightsAgentVersions + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'app_insights_sampling_rate': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'trace_enabled': {'key': 'traceEnabled', 'type': 'bool'}, + 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, + 'app_insights_sampling_rate': {'key': 'appInsightsSamplingRate', 'type': 'float'}, + 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, + } + + def __init__( + self, + *, + error: Optional["Error"] = None, + trace_enabled: Optional[bool] = None, + app_insights_instrumentation_key: Optional[str] = None, + app_insights_sampling_rate: Optional[float] = None, + app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, + **kwargs + ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2022_04_01.models.ApplicationInsightsAgentVersions + """ + super(MonitoringSettingProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.trace_enabled = trace_enabled + self.app_insights_instrumentation_key = app_insights_instrumentation_key + self.app_insights_sampling_rate = app_insights_sampling_rate + self.app_insights_agent_versions = app_insights_agent_versions + + +class MonitoringSettingResource(ProxyResource): + """Monitoring Setting 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingProperties + """ + + _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': 'MonitoringSettingProperties'}, + } + + def __init__( + self, + *, + properties: Optional["MonitoringSettingProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingProperties + """ + super(MonitoringSettingResource, self).__init__(**kwargs) + self.properties = properties + + +class NameAvailability(msrest.serialization.Model): + """Name availability result payload. + + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ + super(NameAvailability, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class NameAvailabilityParameters(msrest.serialization.Model): + """Name availability parameters payload. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = type + self.name = name + + +class NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar runtime_version: Runtime version of the .Net file. + :vartype runtime_version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword runtime_version: Runtime version of the .Net file. + :paramtype runtime_version: str + """ + super(NetCoreZipUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'NetCoreZip' # type: str + self.net_core_main_entry_path = net_core_main_entry_path + self.runtime_version = runtime_version + + +class NetworkProfile(msrest.serialization.Model): + """Service network profile payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Apps Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure + Spring Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Apps service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources for + customer apps in Azure Spring Apps. + :vartype app_network_resource_group: str + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. + :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. + :vartype required_traffics: list[~azure.mgmt.appplatform.v2022_04_01.models.RequiredTraffic] + """ + + _validation = { + 'outbound_i_ps': {'readonly': True}, + 'required_traffics': {'readonly': True}, + } + + _attribute_map = { + 'service_runtime_subnet_id': {'key': 'serviceRuntimeSubnetId', 'type': 'str'}, + 'app_subnet_id': {'key': 'appSubnetId', 'type': 'str'}, + 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, + 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, + 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, + } + + def __init__( + self, + *, + service_runtime_subnet_id: Optional[str] = None, + app_subnet_id: Optional[str] = None, + service_cidr: Optional[str] = None, + service_runtime_network_resource_group: Optional[str] = None, + app_network_resource_group: Optional[str] = None, + **kwargs + ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Apps Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in + Azure Spring Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Apps service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources + for customer apps in Azure Spring Apps. + :paramtype app_network_resource_group: str + """ + super(NetworkProfile, self).__init__(**kwargs) + self.service_runtime_subnet_id = service_runtime_subnet_id + self.app_subnet_id = app_subnet_id + self.service_cidr = service_cidr + self.service_runtime_network_resource_group = service_runtime_network_resource_group + self.app_network_resource_group = app_network_resource_group + self.outbound_i_ps = None + self.required_traffics = None + + +class NetworkProfileOutboundIPs(msrest.serialization.Model): + """Desired outbound IP resources for Azure Spring Apps resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] + """ + + _validation = { + 'public_i_ps': {'readonly': True}, + } + + _attribute_map = { + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkProfileOutboundIPs, self).__init__(**kwargs) + self.public_i_ps = None + + +class OperationDetail(msrest.serialization.Model): + """Operation detail payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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.appplatform.v2022_04_01.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.OperationProperties + """ + + _validation = { + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): + """ + :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.appplatform.v2022_04_01.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.OperationProperties + """ + super(OperationDetail, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.action_type = None + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :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 = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :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(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2022_04_01.models.ServiceSpecification + """ + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +class PersistentDisk(msrest.serialization.Model): + """Persistent disk payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int + :ivar used_in_gb: Size of the used persistent disk in GB. + :vartype used_in_gb: int + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 50, 'minimum': 0}, + 'used_in_gb': {'readonly': True, 'maximum': 50, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'used_in_gb': {'key': 'usedInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ + super(PersistentDisk, self).__init__(**kwargs) + self.size_in_gb = size_in_gb + self.used_in_gb = None + self.mount_path = mount_path + + +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): + """Regenerate test key request payload. + + All required parameters must be populated in order to send to Azure. + + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :vartype key_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.TestKeyType + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "TestKeyType"], + **kwargs + ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.TestKeyType + """ + super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) + self.key_type = key_type + + +class RequiredTraffic(msrest.serialization.Model): + """Required inbound or outbound traffic for Azure Spring Apps resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar protocol: The protocol of required traffic. + :vartype protocol: str + :ivar port: The port of required traffic. + :vartype port: int + :ivar ips: The ip list of required traffic. + :vartype ips: list[str] + :ivar fqdns: The FQDN list of required traffic. + :vartype fqdns: list[str] + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2022_04_01.models.TrafficDirection + """ + + _validation = { + 'protocol': {'readonly': True}, + 'port': {'readonly': True}, + 'ips': {'readonly': True}, + 'fqdns': {'readonly': True}, + 'direction': {'readonly': True}, + } + + _attribute_map = { + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'ips': {'key': 'ips', 'type': '[str]'}, + 'fqdns': {'key': 'fqdns', 'type': '[str]'}, + 'direction': {'key': 'direction', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RequiredTraffic, self).__init__(**kwargs) + self.protocol = None + self.port = None + self.ips = None + self.fqdns = None + self.direction = None + + +class ResourceRequests(msrest.serialization.Model): + """Deployment resource request payload. + + :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :vartype cpu: str + :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, + 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :vartype memory: str + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + cpu: Optional[str] = None, + memory: Optional[str] = None, + **kwargs + ): + """ + :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 + for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :paramtype cpu: str + :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :paramtype memory: str + """ + super(ResourceRequests, self).__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class ResourceSku(msrest.serialization.Model): + """Describes an available Azure Spring Apps SKU. + + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2022_04_01.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. + :vartype location_info: + list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuLocationInfo] + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :vartype restrictions: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictions] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, + 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["ResourceSkuRestrictions"]] = None, + **kwargs + ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2022_04_01.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictions] + """ + super(ResourceSku, self).__init__(**kwargs) + self.resource_type = resource_type + self.name = name + self.tier = tier + self.capacity = capacity + self.locations = locations + self.location_info = location_info + self.restrictions = restrictions + + +class ResourceSkuCapabilities(msrest.serialization.Model): + """ResourceSkuCapabilities. + + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ + super(ResourceSkuCapabilities, self).__init__(**kwargs) + self.name = name + self.value = value + + +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. + + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceSku"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(msrest.serialization.Model): + """Locations and availability zones where the SKU is available. + + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuZoneDetails] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, + **kwargs + ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuZoneDetails] + """ + super(ResourceSkuLocationInfo, self).__init__(**kwargs) + self.location = location + self.zones = zones + self.zone_details = zone_details + + +class ResourceSkuRestrictionInfo(msrest.serialization.Model): + """Information about the restriction where the SKU cannot be used. + + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] + """ + + _attribute_map = { + 'locations': {'key': 'locations', 'type': '[str]'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ + super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) + self.locations = locations + self.zones = zones + + +class ResourceSkuRestrictions(msrest.serialization.Model): + """Restrictions where the SKU cannot be used. + + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :vartype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsType + :ivar values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :vartype restriction_info: + ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :vartype reason_code: str or + ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsReasonCode + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, + 'reason_code': {'key': 'reasonCode', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs + ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsReasonCode + """ + super(ResourceSkuRestrictions, self).__init__(**kwargs) + self.type = type + self.values = values + self.restriction_info = restriction_info + self.reason_code = reason_code + + +class ResourceSkuZoneDetails(msrest.serialization.Model): + """Details of capabilities available to a SKU in specific zones. + + :ivar name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :vartype capabilities: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCapabilities] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, + } + + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["ResourceSkuCapabilities"]] = None, + **kwargs + ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCapabilities] + """ + super(ResourceSkuZoneDetails, self).__init__(**kwargs) + self.name = name + self.capabilities = capabilities + + +class ResourceUploadDefinition(msrest.serialization.Model): + """Resource upload definition payload. + + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str + """ + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + upload_url: Optional[str] = None, + **kwargs + ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ + super(ResourceUploadDefinition, self).__init__(**kwargs) + self.relative_path = relative_path + self.upload_url = upload_url + + +class ServiceRegistryInstance(msrest.serialization.Model): + """Collection of instances belong to the Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Service Registry instance. + :vartype name: str + :ivar status: Status of the Service Registry instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ServiceRegistryProperties(msrest.serialization.Model): + """Service Registry properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Service Registry. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResourceRequests + :ivar instances: Collection of instances belong to Service Registry. + :vartype instances: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ServiceRegistryResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ServiceRegistryInstance]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.resource_requests = None + self.instances = None + + +class ServiceRegistryResource(ProxyResource): + """Service Registry 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Service Registry properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProperties + """ + + _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': 'ServiceRegistryProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ServiceRegistryProperties"] = None, + **kwargs + ): + """ + :keyword properties: Service Registry properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProperties + """ + super(ServiceRegistryResource, self).__init__(**kwargs) + self.properties = properties + + +class ServiceRegistryResourceCollection(msrest.serialization.Model): + """Object that includes an array of Service Registry resources and a possible link for next set. + + :ivar value: Collection of Service Registry resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceRegistryResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceRegistryResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Service Registry resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ServiceRegistryResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceRegistryResourceRequests(msrest.serialization.Model): + """Resource request payload of Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Service Registry instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Service Registry instance. + :vartype memory: str + :ivar instance_count: Instance count of the Service Registry. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class ServiceResource(TrackedResource): + """Service 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku + """ + + _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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ClusterResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku + """ + super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) + self.properties = properties + self.sku = sku + + +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): + """Service specification payload. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.appplatform.v2022_04_01.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: + list[~azure.mgmt.appplatform.v2022_04_01.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2022_04_01.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2022_04_01.models.MetricSpecification] + """ + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class Sku(msrest.serialization.Model): + """Sku of Azure Spring Apps. + + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = "S0", + tier: Optional[str] = "Standard", + capacity: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SkuCapacity(msrest.serialization.Model): + """The SKU capacity. + + All required parameters must be populated in order to send to Azure. + + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.SkuScaleType + """ + + _validation = { + 'minimum': {'required': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.SkuScaleType + """ + super(SkuCapacity, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + self.scale_type = scale_type + + +class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Java source code binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :vartype artifact_selector: str + :ivar runtime_version: Runtime version of the source file. + :vartype runtime_version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + artifact_selector: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + :keyword runtime_version: Runtime version of the source file. + :paramtype runtime_version: str + """ + super(SourceUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'Source' # type: str + self.artifact_selector = artifact_selector + self.runtime_version = runtime_version + + +class StackProperties(msrest.serialization.Model): + """KPack ClusterStack properties payload. + + :ivar id: Id of the ClusterStack. + :vartype id: str + :ivar version: Version of the ClusterStack. + :vartype version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Id of the ClusterStack. + :paramtype id: str + :keyword version: Version of the ClusterStack. + :paramtype version: str + """ + super(StackProperties, self).__init__(**kwargs) + self.id = id + self.version = version + + +class SupportedBuildpackResource(ProxyResource): + """Supported buildpack resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Supported buildpack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResourceProperties + """ + + _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': 'SupportedBuildpackResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["SupportedBuildpackResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Supported buildpack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResourceProperties + """ + super(SupportedBuildpackResource, self).__init__(**kwargs) + self.properties = properties + + +class SupportedBuildpackResourceProperties(msrest.serialization.Model): + """Supported buildpack resource properties. + + :ivar buildpack_id: The id of supported buildpack. + :vartype buildpack_id: str + """ + + _attribute_map = { + 'buildpack_id': {'key': 'buildpackId', 'type': 'str'}, + } + + def __init__( + self, + *, + buildpack_id: Optional[str] = None, + **kwargs + ): + """ + :keyword buildpack_id: The id of supported buildpack. + :paramtype buildpack_id: str + """ + super(SupportedBuildpackResourceProperties, self).__init__(**kwargs) + self.buildpack_id = buildpack_id + + +class SupportedBuildpacksCollection(msrest.serialization.Model): + """Object that includes an array of supported buildpacks resources and a possible link for next set. + + :ivar value: Collection of supported buildpacks resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedBuildpackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SupportedBuildpackResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of supported buildpacks resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(SupportedBuildpacksCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedRuntimeVersion(msrest.serialization.Model): + """Supported deployment runtime version descriptor. + + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "Java_17", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :vartype platform: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'platform': {'key': 'platform', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[Union[str, "SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "Java_17", "NetCore_31". + :paramtype value: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ + super(SupportedRuntimeVersion, self).__init__(**kwargs) + self.value = value + self.platform = platform + self.version = version + + +class SupportedStackResource(ProxyResource): + """Supported stack resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData + :ivar properties: Supported stack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResourceProperties + """ + + _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': 'SupportedStackResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["SupportedStackResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Supported stack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResourceProperties + """ + super(SupportedStackResource, self).__init__(**kwargs) + self.properties = properties + + +class SupportedStackResourceProperties(msrest.serialization.Model): + """Supported stack resource properties. + + :ivar stack_id: The id of supported stack. + :vartype stack_id: str + :ivar version: The version of supported stack. + :vartype version: str + """ + + _attribute_map = { + 'stack_id': {'key': 'stackId', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + stack_id: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword stack_id: The id of supported stack. + :paramtype stack_id: str + :keyword version: The version of supported stack. + :paramtype version: str + """ + super(SupportedStackResourceProperties, self).__init__(**kwargs) + self.stack_id = stack_id + self.version = version + + +class SupportedStacksCollection(msrest.serialization.Model): + """Object that includes an array of supported stacks resources and a possible link for next set. + + :ivar value: Collection of supported stacks resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedStackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SupportedStackResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of supported stacks resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(SupportedStacksCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2022_04_01.models.LastModifiedByType + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "LastModifiedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2022_04_01.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TemporaryDisk(msrest.serialization.Model): + """Temporary disk payload. + + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 5, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = "/tmp", + **kwargs + ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ + super(TemporaryDisk, self).__init__(**kwargs) + self.size_in_gb = size_in_gb + self.mount_path = mount_path + + +class TestKeys(msrest.serialization.Model): + """Test keys payload. + + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'primary_test_endpoint': {'key': 'primaryTestEndpoint', 'type': 'str'}, + 'secondary_test_endpoint': {'key': 'secondaryTestEndpoint', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_test_endpoint: Optional[str] = None, + secondary_test_endpoint: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ + super(TestKeys, self).__init__(**kwargs) + self.primary_key = primary_key + self.secondary_key = secondary_key + self.primary_test_endpoint = primary_test_endpoint + self.secondary_test_endpoint = secondary_test_endpoint + self.enabled = enabled + + +class TriggeredBuildResult(msrest.serialization.Model): + """The build result triggered by a build. + + :ivar id: The unique build id of this build result. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The unique build id of this build result. + :paramtype id: str + """ + super(TriggeredBuildResult, self).__init__(**kwargs) + self.id = id + + +class ValidationMessages(msrest.serialization.Model): + """Validate messages of the configuration service git repositories. + + :ivar name: The name of the configuration service git repository. + :vartype name: str + :ivar messages: Detailed validation messages. + :vartype messages: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'messages': {'key': 'messages', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword name: The name of the configuration service git repository. + :paramtype name: str + :keyword messages: Detailed validation messages. + :paramtype messages: list[str] + """ + super(ValidationMessages, self).__init__(**kwargs) + self.name = name + self.messages = messages diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py new file mode 100644 index 00000000000..152a0c3a076 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._services_operations import ServicesOperations +from ._config_servers_operations import ConfigServersOperations +from ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'ConfigurationServicesOperations', + 'ServiceRegistriesOperations', + 'BuildServiceOperations', + 'BuildpackBindingOperations', + 'BuildServiceBuilderOperations', + 'BuildServiceAgentPoolOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', +] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py new file mode 100644 index 00000000000..8e2678df7da --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py @@ -0,0 +1,1190 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_active_deployments_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class AppsOperations(object): + """AppsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + + @distributed_trace + def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._set_active_deployments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + + @distributed_trace + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py new file mode 100644 index 00000000000..d8a5486c764 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py @@ -0,0 +1,823 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BindingsOperations(object): + """BindingsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py new file mode 100644 index 00000000000..46ed30daead --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,475 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class BuildServiceAgentPoolOperations(object): + """BuildServiceAgentPoolOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> LROPoller["_models.BuildServiceAgentPoolResource"]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py new file mode 100644 index 00000000000..47acb0bb488 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py @@ -0,0 +1,631 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BuildServiceBuilderOperations(object): + """BuildServiceBuilderOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> "_models.BuilderResource": + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> "_models.BuilderResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> LROPoller["_models.BuilderResource"]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. + :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuilderResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuilderResourceCollection"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py new file mode 100644 index 00000000000..7b06e603558 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py @@ -0,0 +1,1506 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_build_services_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_service_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_builds_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_build_results_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_result_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_result_log_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_supported_buildpacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_supported_buildpack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_supported_stacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_supported_stack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BuildServiceOperations(object): + """BuildServiceOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_build_services( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceCollection"]: + """List build services resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + + @distributed_trace + def get_build_service( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.BuildService": + """Get a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_build_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + + + @distributed_trace + def list_builds( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildCollection"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildCollection or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + + @distributed_trace + def get_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> "_models.Build": + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.get_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: "_models.Build", + **kwargs: Any + ) -> "_models.Build": + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build: Parameters for the create or update operation. + :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Build', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace + def list_build_results( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildResultCollection"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildResultCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildResultCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + + @distributed_trace + def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResult": + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + + + @distributed_trace + def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResultLog": + """Get a KPack build result log download URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultLog + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResultLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + + + @distributed_trace + def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for build service, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace + def list_supported_buildpacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpacksCollection": + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_buildpacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + + + @distributed_trace + def get_supported_buildpack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpackResource": + """Get the supported buildpack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + api_version=api_version, + template_url=self.get_supported_buildpack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + + + @distributed_trace + def list_supported_stacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedStacksCollection": + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_stacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + + + @distributed_trace + def get_supported_stack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any + ) -> "_models.SupportedStackResource": + """Get the supported stack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param stack_name: The name of the stack resource. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + api_version=api_version, + template_url=self.get_supported_stack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py new file mode 100644 index 00000000000..e6e495b96e9 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py @@ -0,0 +1,660 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BuildpackBindingOperations(object): + """BuildpackBindingOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> LROPoller["_models.BuildpackBindingResource"]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Buildpack Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildpackBindingResourceCollection"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py new file mode 100644 index 00000000000..dcc60dcc7f5 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py @@ -0,0 +1,605 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class CertificatesOperations(object): + """CertificatesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py new file mode 100644 index 00000000000..6c8346d206a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py @@ -0,0 +1,664 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class ConfigServersOperations(object): + """ConfigServersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py new file mode 100644 index 00000000000..4445a51fd11 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py @@ -0,0 +1,785 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class ConfigurationServicesOperations(object): + """ConfigurationServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + """Get the Application Configuration Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceResource"]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Application Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ConfigurationServiceResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> "_models.ConfigurationServiceSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. + :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + settings=settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..411a7af4d43 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py @@ -0,0 +1,823 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class CustomDomainsOperations(object): + """CustomDomainsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py new file mode 100644 index 00000000000..d9b0bc5e624 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py @@ -0,0 +1,2069 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_generate_heap_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_generate_thread_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_jfr_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class DeploymentsOperations(object): # pylint: disable=too-many-public-methods + """DeploymentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + @distributed_trace + def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + + @distributed_trace + def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._generate_heap_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + + @distributed_trace + def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._generate_thread_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + + + @distributed_trace + def begin_start_jfr( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_jfr_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py new file mode 100644 index 00000000000..ed3089493c2 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py @@ -0,0 +1,493 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class MonitoringSettingsOperations(object): + """MonitoringSettingsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py new file mode 100644 index 00000000000..8aa9a994c27 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..4295dc5119c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py @@ -0,0 +1,122 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class RuntimeVersionsOperations(object): + """RuntimeVersionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py new file mode 100644 index 00000000000..6f1001b7b9c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py @@ -0,0 +1,582 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ServiceRegistriesOperations(object): + """ServiceRegistriesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + """Get the Service Registry and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller["_models.ServiceRegistryResource"]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceRegistryResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py new file mode 100644 index 00000000000..99a8f74e7b2 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py @@ -0,0 +1,1348 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ServicesOperations(object): + """ServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace + def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + + @distributed_trace + def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + @distributed_trace + def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: + ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py new file mode 100644 index 00000000000..4b65de70e55 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py @@ -0,0 +1,153 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class SkusOperations(object): + """SkusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_04_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-04-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py new file mode 100644 index 00000000000..41ec6d71ff7 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py new file mode 100644 index 00000000000..68cee389f37 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py @@ -0,0 +1,180 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes + """REST API for Azure Spring Apps. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2022_05_01_preview.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2022_05_01_preview.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_05_01_preview.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2022_05_01_preview.operations.ServiceRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: + azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_05_01_preview.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2022_05_01_preview.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2022_05_01_preview.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2022_05_01_preview.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2022_05_01_preview.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2022_05_01_preview.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2022_05_01_preview.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2022_05_01_preview.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_05_01_preview.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2022_05_01_preview.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: + azure.mgmt.appplatform.v2022_05_01_preview.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2022_05_01_preview.operations.ApiPortalCustomDomainsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AppPlatformManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py new file mode 100644 index 00000000000..e8e7fc80c5d --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py new file mode 100644 index 00000000000..92453d8691d --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "6.1.0" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py new file mode 100644 index 00000000000..44ce4a5043f --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._app_platform_management_client import AppPlatformManagementClient +__all__ = ['AppPlatformManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py new file mode 100644 index 00000000000..9df90c90928 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes + """REST API for Azure Spring Apps. + + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServicesOperations + :ivar config_servers: ConfigServersOperations operations + :vartype config_servers: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ConfigServersOperations + :ivar configuration_services: ConfigurationServicesOperations operations + :vartype configuration_services: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ConfigurationServicesOperations + :ivar service_registries: ServiceRegistriesOperations operations + :vartype service_registries: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServiceRegistriesOperations + :ivar build_service: BuildServiceOperations operations + :vartype build_service: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceOperations + :ivar buildpack_binding: BuildpackBindingOperations operations + :vartype buildpack_binding: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildpackBindingOperations + :ivar build_service_builder: BuildServiceBuilderOperations operations + :vartype build_service_builder: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceBuilderOperations + :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations + :vartype build_service_agent_pool: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceAgentPoolOperations + :ivar monitoring_settings: MonitoringSettingsOperations operations + :vartype monitoring_settings: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.MonitoringSettingsOperations + :ivar apps: AppsOperations operations + :vartype apps: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.AppsOperations + :ivar bindings: BindingsOperations operations + :vartype bindings: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BindingsOperations + :ivar storages: StoragesOperations operations + :vartype storages: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.StoragesOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.CertificatesOperations + :ivar custom_domains: CustomDomainsOperations operations + :vartype custom_domains: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.CustomDomainsOperations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.DeploymentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.Operations + :ivar runtime_versions: RuntimeVersionsOperations operations + :vartype runtime_versions: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.RuntimeVersionsOperations + :ivar skus: SkusOperations operations + :vartype skus: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.SkusOperations + :ivar gateways: GatewaysOperations operations + :vartype gateways: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewaysOperations + :ivar gateway_route_configs: GatewayRouteConfigsOperations operations + :vartype gateway_route_configs: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewayRouteConfigsOperations + :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations + :vartype gateway_custom_domains: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewayCustomDomainsOperations + :ivar api_portals: ApiPortalsOperations operations + :vartype api_portals: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ApiPortalsOperations + :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations + :vartype api_portal_custom_domains: + azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ApiPortalCustomDomainsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AppPlatformManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py new file mode 100644 index 00000000000..ecc6689ee8b --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for AppPlatformManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.py new file mode 100644 index 00000000000..0da100b4246 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.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 ._services_operations import ServicesOperations +from ._config_servers_operations import ConfigServersOperations +from ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._storages_operations import StoragesOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations +from ._gateways_operations import GatewaysOperations +from ._gateway_route_configs_operations import GatewayRouteConfigsOperations +from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations +from ._api_portals_operations import ApiPortalsOperations +from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'ConfigurationServicesOperations', + 'ServiceRegistriesOperations', + 'BuildServiceOperations', + 'BuildpackBindingOperations', + 'BuildServiceBuilderOperations', + 'BuildServiceAgentPoolOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'StoragesOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', + 'GatewaysOperations', + 'GatewayRouteConfigsOperations', + 'GatewayCustomDomainsOperations', + 'ApiPortalsOperations', + 'ApiPortalCustomDomainsOperations', +] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 00000000000..bc1dd276e63 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,464 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_portal_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApiPortalCustomDomainsOperations: + """ApiPortalCustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + """Get the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ApiPortalCustomDomainResource"]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalCustomDomainResourceCollection"]: + """Handle requests to list all API portal custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py new file mode 100644 index 00000000000..2f49464fc05 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py @@ -0,0 +1,512 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._api_portals_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApiPortalsOperations: + """ApiPortalsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> "_models.ApiPortalResource": + """Get the API portal and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> "_models.ApiPortalResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ApiPortalResource"]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. + :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_portal_resource=api_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the default API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ApiPortalResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py new file mode 100644 index 00000000000..c1d78c25bbe --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py @@ -0,0 +1,853 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_set_active_deployments_request_initial, build_update_request_initial, build_validate_domain_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AppsOperations: + """AppsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AppResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + + @distributed_trace_async + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + async def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._set_active_deployments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + + @distributed_trace_async + async def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> AsyncLROPoller["_models.AppResource"]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py new file mode 100644 index 00000000000..ff5b8848165 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py @@ -0,0 +1,606 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BindingsOperations: + """BindingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BindingResource"]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py new file mode 100644 index 00000000000..8c31315fc36 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,346 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_agent_pool_operations import build_get_request, build_list_request, build_update_put_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceAgentPoolOperations: + """BuildServiceAgentPoolOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceAgentPoolResourceCollection"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuildServiceAgentPoolResource"]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py new file mode 100644 index 00000000000..15ca47b7f80 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py @@ -0,0 +1,462 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_builder_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceBuilderOperations: + """BuildServiceBuilderOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> "_models.BuilderResource": + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> "_models.BuilderResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuilderResource"]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. + :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuilderResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuilderResourceCollection"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py new file mode 100644 index 00000000000..98ec096bafc --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py @@ -0,0 +1,985 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._build_service_operations import build_create_or_update_build_request, build_get_build_request, build_get_build_result_log_request, build_get_build_result_request, build_get_build_service_request, build_get_resource_upload_url_request, build_get_supported_buildpack_request, build_get_supported_stack_request, build_list_build_results_request, build_list_build_services_request, build_list_builds_request, build_list_supported_buildpacks_request, build_list_supported_stacks_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildServiceOperations: + """BuildServiceOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_build_services( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildServiceCollection"]: + """List build services resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + + @distributed_trace_async + async def get_build_service( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.BuildService": + """Get a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_build_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + + + @distributed_trace + def list_builds( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildCollection"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildCollection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + + @distributed_trace_async + async def get_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> "_models.Build": + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.get_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace_async + async def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: "_models.Build", + **kwargs: Any + ) -> "_models.Build": + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build: Parameters for the create or update operation. + :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Build', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace + def list_build_results( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildResultCollection"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildResultCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + + @distributed_trace_async + async def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResult": + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + + + @distributed_trace_async + async def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResultLog": + """Get a KPack build result log download URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultLog + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResultLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + + + @distributed_trace_async + async def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for build service, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace_async + async def list_supported_buildpacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpacksCollection": + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_buildpacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + + + @distributed_trace_async + async def get_supported_buildpack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpackResource": + """Get the supported buildpack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + api_version=api_version, + template_url=self.get_supported_buildpack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + + + @distributed_trace_async + async def list_supported_stacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedStacksCollection": + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_stacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + + + @distributed_trace_async + async def get_supported_stack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any + ) -> "_models.SupportedStackResource": + """Get the supported stack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param stack_name: The name of the stack resource. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + api_version=api_version, + template_url=self.get_supported_stack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py new file mode 100644 index 00000000000..3cb2c20da4c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py @@ -0,0 +1,484 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._buildpack_binding_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BuildpackBindingOperations: + """BuildpackBindingOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.BuildpackBindingResource"]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Buildpack Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.BuildpackBindingResourceCollection"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py new file mode 100644 index 00000000000..a5c1f9d4822 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py @@ -0,0 +1,445 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CertificateResource"]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py new file mode 100644 index 00000000000..0aee3558712 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py @@ -0,0 +1,495 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigServersOperations: + """ConfigServersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py new file mode 100644 index 00000000000..c7b36fd45a1 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py @@ -0,0 +1,578 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._configuration_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ConfigurationServicesOperations: + """ConfigurationServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + """Get the Application Configuration Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationServiceResource"]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Application Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ConfigurationServiceResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> "_models.ConfigurationServiceSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> AsyncLROPoller["_models.ConfigurationServiceSettingsValidateResult"]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. + :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + settings=settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..bde04206fe5 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py @@ -0,0 +1,606 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CustomDomainsOperations: + """CustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.CustomDomainResource"]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py new file mode 100644 index 00000000000..e746cc785ad --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py @@ -0,0 +1,1509 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """DeploymentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + async def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + + @distributed_trace_async + async def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + @distributed_trace_async + async def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + + @distributed_trace_async + async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._generate_heap_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + + @distributed_trace_async + async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._generate_thread_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + + + @distributed_trace_async + async def begin_start_jfr( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_jfr_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py new file mode 100644 index 00000000000..97cbd33073f --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,464 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gateway_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GatewayCustomDomainsOperations: + """GatewayCustomDomainsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + """Get the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.GatewayCustomDomainResource"]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GatewayCustomDomainResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py new file mode 100644 index 00000000000..0ffbd29ea9c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py @@ -0,0 +1,465 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gateway_route_configs_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GatewayRouteConfigsOperations: + """GatewayRouteConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + """Get the Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayRouteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.GatewayRouteConfigResource"]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the Spring Cloud Gateway route config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GatewayRouteConfigResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py new file mode 100644 index 00000000000..71c8d9c05db --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py @@ -0,0 +1,512 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._gateways_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GatewaysOperations: + """GatewaysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> "_models.GatewayResource": + """Get the Spring Cloud Gateway and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GatewayResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> "_models.GatewayResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_resource, 'GatewayResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('GatewayResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.GatewayResource"]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. + :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + gateway_resource=gateway_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GatewayResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GatewayResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + + @distributed_trace_async + async def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py new file mode 100644 index 00000000000..592b75bc3d1 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py @@ -0,0 +1,365 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MonitoringSettingsOperations: + """MonitoringSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + async def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + async def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace_async + async def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py new file mode 100644 index 00000000000..729c941a718 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py @@ -0,0 +1,115 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..c3875b6b2aa --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py @@ -0,0 +1,93 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._runtime_versions_operations import build_list_runtime_versions_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RuntimeVersionsOperations: + """RuntimeVersionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py new file mode 100644 index 00000000000..33d846f4936 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py @@ -0,0 +1,430 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._service_registries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServiceRegistriesOperations: + """ServiceRegistriesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + """Get the Service Registry and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceRegistryResource"]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceRegistryResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py new file mode 100644 index 00000000000..f27d352f11c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py @@ -0,0 +1,1135 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ServicesOperations: + """ServicesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace_async + async def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace_async + async def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace_async + async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + + @distributed_trace_async + async def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + async def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + + + @distributed_trace_async + async def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stop a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + + async def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + + + @distributed_trace_async + async def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Start a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + + @distributed_trace_async + async def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py new file mode 100644 index 00000000000..b540584f4bc --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py @@ -0,0 +1,118 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._skus_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SkusOperations: + """SkusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceSkuCollection"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py new file mode 100644 index 00000000000..ca59fae045d --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py @@ -0,0 +1,444 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._storages_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StoragesOperations: + """StoragesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> "_models.StorageResource": + """Get the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param storage_name: The name of the storage resource. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> "_models.StorageResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.StorageResource"]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param storage_name: The name of the storage resource. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. + :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param storage_name: The name of the storage resource. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.StorageResourceCollection"]: + """List all the storages of one Azure Spring Apps resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StorageResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py new file mode 100644 index 00000000000..6d9492be191 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py @@ -0,0 +1,441 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import ActiveDeploymentCollection +from ._models_py3 import ApiPortalCustomDomainProperties +from ._models_py3 import ApiPortalCustomDomainResource +from ._models_py3 import ApiPortalCustomDomainResourceCollection +from ._models_py3 import ApiPortalInstance +from ._models_py3 import ApiPortalProperties +from ._models_py3 import ApiPortalResource +from ._models_py3 import ApiPortalResourceCollection +from ._models_py3 import ApiPortalResourceRequests +from ._models_py3 import AppResource +from ._models_py3 import AppResourceCollection +from ._models_py3 import AppResourceProperties +from ._models_py3 import AppVNetAddons +from ._models_py3 import ApplicationInsightsAgentVersions +from ._models_py3 import AvailableOperations +from ._models_py3 import AvailableRuntimeVersions +from ._models_py3 import AzureFileVolume +from ._models_py3 import BindingResource +from ._models_py3 import BindingResourceCollection +from ._models_py3 import BindingResourceProperties +from ._models_py3 import Build +from ._models_py3 import BuildCollection +from ._models_py3 import BuildProperties +from ._models_py3 import BuildResourceRequests +from ._models_py3 import BuildResult +from ._models_py3 import BuildResultCollection +from ._models_py3 import BuildResultLog +from ._models_py3 import BuildResultProperties +from ._models_py3 import BuildResultUserSourceInfo +from ._models_py3 import BuildService +from ._models_py3 import BuildServiceAgentPoolProperties +from ._models_py3 import BuildServiceAgentPoolResource +from ._models_py3 import BuildServiceAgentPoolResourceCollection +from ._models_py3 import BuildServiceAgentPoolSizeProperties +from ._models_py3 import BuildServiceCollection +from ._models_py3 import BuildServiceProperties +from ._models_py3 import BuildServicePropertiesResourceRequests +from ._models_py3 import BuildStageProperties +from ._models_py3 import BuilderProperties +from ._models_py3 import BuilderResource +from ._models_py3 import BuilderResourceCollection +from ._models_py3 import BuildpackBindingLaunchProperties +from ._models_py3 import BuildpackBindingProperties +from ._models_py3 import BuildpackBindingResource +from ._models_py3 import BuildpackBindingResourceCollection +from ._models_py3 import BuildpackProperties +from ._models_py3 import BuildpacksGroupProperties +from ._models_py3 import CertificateProperties +from ._models_py3 import CertificateResource +from ._models_py3 import CertificateResourceCollection +from ._models_py3 import CloudErrorBody +from ._models_py3 import ClusterResourceProperties +from ._models_py3 import ConfigServerGitProperty +from ._models_py3 import ConfigServerProperties +from ._models_py3 import ConfigServerResource +from ._models_py3 import ConfigServerSettings +from ._models_py3 import ConfigServerSettingsErrorRecord +from ._models_py3 import ConfigServerSettingsValidateResult +from ._models_py3 import ConfigurationServiceGitProperty +from ._models_py3 import ConfigurationServiceGitPropertyValidateResult +from ._models_py3 import ConfigurationServiceGitRepository +from ._models_py3 import ConfigurationServiceInstance +from ._models_py3 import ConfigurationServiceProperties +from ._models_py3 import ConfigurationServiceResource +from ._models_py3 import ConfigurationServiceResourceCollection +from ._models_py3 import ConfigurationServiceResourceRequests +from ._models_py3 import ConfigurationServiceSettings +from ._models_py3 import ConfigurationServiceSettingsValidateResult +from ._models_py3 import ContainerProbeSettings +from ._models_py3 import ContentCertificateProperties +from ._models_py3 import CustomContainer +from ._models_py3 import CustomContainerUserSourceInfo +from ._models_py3 import CustomDomainProperties +from ._models_py3 import CustomDomainResource +from ._models_py3 import CustomDomainResourceCollection +from ._models_py3 import CustomDomainValidatePayload +from ._models_py3 import CustomDomainValidateResult +from ._models_py3 import CustomPersistentDiskProperties +from ._models_py3 import CustomPersistentDiskResource +from ._models_py3 import DeploymentInstance +from ._models_py3 import DeploymentResource +from ._models_py3 import DeploymentResourceCollection +from ._models_py3 import DeploymentResourceProperties +from ._models_py3 import DeploymentSettings +from ._models_py3 import DiagnosticParameters +from ._models_py3 import Error +from ._models_py3 import ExecAction +from ._models_py3 import GatewayApiMetadataProperties +from ._models_py3 import GatewayApiRoute +from ._models_py3 import GatewayCorsProperties +from ._models_py3 import GatewayCustomDomainProperties +from ._models_py3 import GatewayCustomDomainResource +from ._models_py3 import GatewayCustomDomainResourceCollection +from ._models_py3 import GatewayInstance +from ._models_py3 import GatewayOperatorProperties +from ._models_py3 import GatewayOperatorResourceRequests +from ._models_py3 import GatewayProperties +from ._models_py3 import GatewayResource +from ._models_py3 import GatewayResourceCollection +from ._models_py3 import GatewayResourceRequests +from ._models_py3 import GatewayRouteConfigOpenApiProperties +from ._models_py3 import GatewayRouteConfigProperties +from ._models_py3 import GatewayRouteConfigResource +from ._models_py3 import GatewayRouteConfigResourceCollection +from ._models_py3 import GitPatternRepository +from ._models_py3 import HTTPGetAction +from ._models_py3 import ImageRegistryCredential +from ._models_py3 import IngressConfig +from ._models_py3 import JarUploadedUserSourceInfo +from ._models_py3 import KeyVaultCertificateProperties +from ._models_py3 import LoadedCertificate +from ._models_py3 import LogFileUrlResponse +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedIdentityProperties +from ._models_py3 import MarketplaceResource +from ._models_py3 import MetricDimension +from ._models_py3 import MetricSpecification +from ._models_py3 import MonitoringSettingProperties +from ._models_py3 import MonitoringSettingResource +from ._models_py3 import NameAvailability +from ._models_py3 import NameAvailabilityParameters +from ._models_py3 import NetCoreZipUploadedUserSourceInfo +from ._models_py3 import NetworkProfile +from ._models_py3 import NetworkProfileOutboundIPs +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationProperties +from ._models_py3 import PersistentDisk +from ._models_py3 import Probe +from ._models_py3 import ProbeAction +from ._models_py3 import ProxyResource +from ._models_py3 import RegenerateTestKeyRequestPayload +from ._models_py3 import RequiredTraffic +from ._models_py3 import Resource +from ._models_py3 import ResourceRequests +from ._models_py3 import ResourceSku +from ._models_py3 import ResourceSkuCapabilities +from ._models_py3 import ResourceSkuCollection +from ._models_py3 import ResourceSkuLocationInfo +from ._models_py3 import ResourceSkuRestrictionInfo +from ._models_py3 import ResourceSkuRestrictions +from ._models_py3 import ResourceSkuZoneDetails +from ._models_py3 import ResourceUploadDefinition +from ._models_py3 import ServiceRegistryInstance +from ._models_py3 import ServiceRegistryProperties +from ._models_py3 import ServiceRegistryResource +from ._models_py3 import ServiceRegistryResourceCollection +from ._models_py3 import ServiceRegistryResourceRequests +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceSpecification +from ._models_py3 import ServiceVNetAddons +from ._models_py3 import Sku +from ._models_py3 import SkuCapacity +from ._models_py3 import SourceUploadedUserSourceInfo +from ._models_py3 import SsoProperties +from ._models_py3 import StackProperties +from ._models_py3 import StorageAccount +from ._models_py3 import StorageProperties +from ._models_py3 import StorageResource +from ._models_py3 import StorageResourceCollection +from ._models_py3 import SupportedBuildpackResource +from ._models_py3 import SupportedBuildpackResourceProperties +from ._models_py3 import SupportedBuildpacksCollection +from ._models_py3 import SupportedRuntimeVersion +from ._models_py3 import SupportedStackResource +from ._models_py3 import SupportedStackResourceProperties +from ._models_py3 import SupportedStacksCollection +from ._models_py3 import SystemData +from ._models_py3 import TCPSocketAction +from ._models_py3 import TemporaryDisk +from ._models_py3 import TestKeys +from ._models_py3 import TrackedResource +from ._models_py3 import TriggeredBuildResult +from ._models_py3 import UploadedUserSourceInfo +from ._models_py3 import UserAssignedManagedIdentity +from ._models_py3 import UserSourceInfo +from ._models_py3 import ValidationMessages + + +from ._app_platform_management_client_enums import ( + ActionType, + ApiPortalProvisioningState, + AppResourceProvisioningState, + BindingType, + BuildProvisioningState, + BuildResultProvisioningState, + BuildServiceProvisioningState, + BuilderProvisioningState, + BuildpackBindingProvisioningState, + CertificateResourceProvisioningState, + ConfigServerState, + ConfigurationServiceProvisioningState, + CreatedByType, + CustomDomainResourceProvisioningState, + DeploymentResourceProvisioningState, + DeploymentResourceStatus, + GatewayProvisioningState, + HTTPSchemeType, + KPackBuildStageProvisioningState, + LastModifiedByType, + ManagedIdentityType, + MonitoringSettingState, + PowerState, + ProbeActionType, + ProvisioningState, + ResourceSkuRestrictionsReasonCode, + ResourceSkuRestrictionsType, + ServiceRegistryProvisioningState, + SkuScaleType, + StorageType, + SupportedRuntimePlatform, + SupportedRuntimeValue, + TestKeyType, + TrafficDirection, + Type, +) + +__all__ = [ + 'ActiveDeploymentCollection', + 'ApiPortalCustomDomainProperties', + 'ApiPortalCustomDomainResource', + 'ApiPortalCustomDomainResourceCollection', + 'ApiPortalInstance', + 'ApiPortalProperties', + 'ApiPortalResource', + 'ApiPortalResourceCollection', + 'ApiPortalResourceRequests', + 'AppResource', + 'AppResourceCollection', + 'AppResourceProperties', + 'AppVNetAddons', + 'ApplicationInsightsAgentVersions', + 'AvailableOperations', + 'AvailableRuntimeVersions', + 'AzureFileVolume', + 'BindingResource', + 'BindingResourceCollection', + 'BindingResourceProperties', + 'Build', + 'BuildCollection', + 'BuildProperties', + 'BuildResourceRequests', + 'BuildResult', + 'BuildResultCollection', + 'BuildResultLog', + 'BuildResultProperties', + 'BuildResultUserSourceInfo', + 'BuildService', + 'BuildServiceAgentPoolProperties', + 'BuildServiceAgentPoolResource', + 'BuildServiceAgentPoolResourceCollection', + 'BuildServiceAgentPoolSizeProperties', + 'BuildServiceCollection', + 'BuildServiceProperties', + 'BuildServicePropertiesResourceRequests', + 'BuildStageProperties', + 'BuilderProperties', + 'BuilderResource', + 'BuilderResourceCollection', + 'BuildpackBindingLaunchProperties', + 'BuildpackBindingProperties', + 'BuildpackBindingResource', + 'BuildpackBindingResourceCollection', + 'BuildpackProperties', + 'BuildpacksGroupProperties', + 'CertificateProperties', + 'CertificateResource', + 'CertificateResourceCollection', + 'CloudErrorBody', + 'ClusterResourceProperties', + 'ConfigServerGitProperty', + 'ConfigServerProperties', + 'ConfigServerResource', + 'ConfigServerSettings', + 'ConfigServerSettingsErrorRecord', + 'ConfigServerSettingsValidateResult', + 'ConfigurationServiceGitProperty', + 'ConfigurationServiceGitPropertyValidateResult', + 'ConfigurationServiceGitRepository', + 'ConfigurationServiceInstance', + 'ConfigurationServiceProperties', + 'ConfigurationServiceResource', + 'ConfigurationServiceResourceCollection', + 'ConfigurationServiceResourceRequests', + 'ConfigurationServiceSettings', + 'ConfigurationServiceSettingsValidateResult', + 'ContainerProbeSettings', + 'ContentCertificateProperties', + 'CustomContainer', + 'CustomContainerUserSourceInfo', + 'CustomDomainProperties', + 'CustomDomainResource', + 'CustomDomainResourceCollection', + 'CustomDomainValidatePayload', + 'CustomDomainValidateResult', + 'CustomPersistentDiskProperties', + 'CustomPersistentDiskResource', + 'DeploymentInstance', + 'DeploymentResource', + 'DeploymentResourceCollection', + 'DeploymentResourceProperties', + 'DeploymentSettings', + 'DiagnosticParameters', + 'Error', + 'ExecAction', + 'GatewayApiMetadataProperties', + 'GatewayApiRoute', + 'GatewayCorsProperties', + 'GatewayCustomDomainProperties', + 'GatewayCustomDomainResource', + 'GatewayCustomDomainResourceCollection', + 'GatewayInstance', + 'GatewayOperatorProperties', + 'GatewayOperatorResourceRequests', + 'GatewayProperties', + 'GatewayResource', + 'GatewayResourceCollection', + 'GatewayResourceRequests', + 'GatewayRouteConfigOpenApiProperties', + 'GatewayRouteConfigProperties', + 'GatewayRouteConfigResource', + 'GatewayRouteConfigResourceCollection', + 'GitPatternRepository', + 'HTTPGetAction', + 'ImageRegistryCredential', + 'IngressConfig', + 'JarUploadedUserSourceInfo', + 'KeyVaultCertificateProperties', + 'LoadedCertificate', + 'LogFileUrlResponse', + 'LogSpecification', + 'ManagedIdentityProperties', + 'MarketplaceResource', + 'MetricDimension', + 'MetricSpecification', + 'MonitoringSettingProperties', + 'MonitoringSettingResource', + 'NameAvailability', + 'NameAvailabilityParameters', + 'NetCoreZipUploadedUserSourceInfo', + 'NetworkProfile', + 'NetworkProfileOutboundIPs', + 'OperationDetail', + 'OperationDisplay', + 'OperationProperties', + 'PersistentDisk', + 'Probe', + 'ProbeAction', + 'ProxyResource', + 'RegenerateTestKeyRequestPayload', + 'RequiredTraffic', + 'Resource', + 'ResourceRequests', + 'ResourceSku', + 'ResourceSkuCapabilities', + 'ResourceSkuCollection', + 'ResourceSkuLocationInfo', + 'ResourceSkuRestrictionInfo', + 'ResourceSkuRestrictions', + 'ResourceSkuZoneDetails', + 'ResourceUploadDefinition', + 'ServiceRegistryInstance', + 'ServiceRegistryProperties', + 'ServiceRegistryResource', + 'ServiceRegistryResourceCollection', + 'ServiceRegistryResourceRequests', + 'ServiceResource', + 'ServiceResourceList', + 'ServiceSpecification', + 'ServiceVNetAddons', + 'Sku', + 'SkuCapacity', + 'SourceUploadedUserSourceInfo', + 'SsoProperties', + 'StackProperties', + 'StorageAccount', + 'StorageProperties', + 'StorageResource', + 'StorageResourceCollection', + 'SupportedBuildpackResource', + 'SupportedBuildpackResourceProperties', + 'SupportedBuildpacksCollection', + 'SupportedRuntimeVersion', + 'SupportedStackResource', + 'SupportedStackResourceProperties', + 'SupportedStacksCollection', + 'SystemData', + 'TCPSocketAction', + 'TemporaryDisk', + 'TestKeys', + 'TrackedResource', + 'TriggeredBuildResult', + 'UploadedUserSourceInfo', + 'UserAssignedManagedIdentity', + 'UserSourceInfo', + 'ValidationMessages', + 'ActionType', + 'ApiPortalProvisioningState', + 'AppResourceProvisioningState', + 'BindingType', + 'BuildProvisioningState', + 'BuildResultProvisioningState', + 'BuildServiceProvisioningState', + 'BuilderProvisioningState', + 'BuildpackBindingProvisioningState', + 'CertificateResourceProvisioningState', + 'ConfigServerState', + 'ConfigurationServiceProvisioningState', + 'CreatedByType', + 'CustomDomainResourceProvisioningState', + 'DeploymentResourceProvisioningState', + 'DeploymentResourceStatus', + 'GatewayProvisioningState', + 'HTTPSchemeType', + 'KPackBuildStageProvisioningState', + 'LastModifiedByType', + 'ManagedIdentityType', + 'MonitoringSettingState', + 'PowerState', + 'ProbeActionType', + 'ProvisioningState', + 'ResourceSkuRestrictionsReasonCode', + 'ResourceSkuRestrictionsType', + 'ServiceRegistryProvisioningState', + 'SkuScaleType', + 'StorageType', + 'SupportedRuntimePlatform', + 'SupportedRuntimeValue', + 'TestKeyType', + 'TrafficDirection', + 'Type', +] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py new file mode 100644 index 00000000000..593ef2e2513 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py @@ -0,0 +1,329 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + """ + + INTERNAL = "Internal" + +class ApiPortalProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the API portal. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the App + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + +class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Buildpack Binding Type + """ + + APPLICATION_INSIGHTS = "ApplicationInsights" + APACHE_SKY_WALKING = "ApacheSkyWalking" + APP_DYNAMICS = "AppDynamics" + DYNATRACE = "Dynatrace" + NEW_RELIC = "NewRelic" + ELASTIC_APM = "ElasticAPM" + +class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Builder provision status. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Buildpack Binding. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + QUEUING = "Queuing" + BUILDING = "Building" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the KPack build result + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class CertificateResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Certificate + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the config server. + """ + + NOT_AVAILABLE = "NotAvailable" + DELETED = "Deleted" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Application Configuration Service. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class CustomDomainResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Domain + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Deployment + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Status of the Deployment + """ + + STOPPED = "Stopped" + RUNNING = "Running" + +class GatewayProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Spring Cloud Gateway. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class HTTPSchemeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https:// + """ + + HTTP = "HTTP" + HTTPS = "HTTPS" + +class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of this build stage resource. + """ + + NOT_STARTED = "NotStarted" + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that last modified the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the managed identity + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Monitoring Setting. + """ + + NOT_AVAILABLE = "NotAvailable" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + +class PowerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Power state of the Service + """ + + RUNNING = "Running" + STOPPED = "Stopped" + +class ProbeActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the action to take to perform the health check. + """ + + HTTP_GET_ACTION = "HTTPGetAction" + TCP_SOCKET_ACTION = "TCPSocketAction" + EXEC_ACTION = "ExecAction" + +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Service + """ + + CREATING = "Creating" + UPDATING = "Updating" + STARTING = "Starting" + STOPPING = "Stopping" + DELETING = "Deleting" + DELETED = "Deleted" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + MOVED = "Moved" + MOVE_FAILED = "MoveFailed" + +class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription' + """ + + QUOTA_ID = "QuotaId" + NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" + +class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets the type of restrictions. Possible values include: 'Location', 'Zone' + """ + + LOCATION = "Location" + ZONE = "Zone" + +class ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """State of the Service Registry. + """ + + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + DELETING = "Deleting" + +class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Gets or sets the type of the scale. + """ + + NONE = "None" + MANUAL = "Manual" + AUTOMATIC = "Automatic" + +class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the storage. + """ + + STORAGE_ACCOUNT = "StorageAccount" + +class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The platform of this runtime version (possible values: "Java" or ".NET"). + """ + + JAVA = "Java" + _NET_CORE = ".NET Core" + +class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The raw value which could be passed to deployment CRUD operations. + """ + + JAVA8 = "Java_8" + JAVA11 = "Java_11" + JAVA17 = "Java_17" + NET_CORE31 = "NetCore_31" + +class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the test key + """ + + PRIMARY = "Primary" + SECONDARY = "Secondary" + +class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The direction of required traffic + """ + + INBOUND = "Inbound" + OUTBOUND = "Outbound" + +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of the underlying resource to mount as a persistent disk. + """ + + AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py new file mode 100644 index 00000000000..a01cb1cec2a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py @@ -0,0 +1,8111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 datetime +from typing import Any, Dict, List, Optional, Union + +import msrest.serialization + +from ._app_platform_management_client_enums import * + + +class ActiveDeploymentCollection(msrest.serialization.Model): + """Object that includes an array of Deployment resource name and set them as active. + + :ivar active_deployment_names: Collection of Deployment name. + :vartype active_deployment_names: list[str] + """ + + _attribute_map = { + 'active_deployment_names': {'key': 'activeDeploymentNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + active_deployment_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword active_deployment_names: Collection of Deployment name. + :paramtype active_deployment_names: list[str] + """ + super(ActiveDeploymentCollection, self).__init__(**kwargs) + self.active_deployment_names = active_deployment_names + + +class ApiPortalCustomDomainProperties(msrest.serialization.Model): + """The properties of custom domain for API portal. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + """ + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + } + + def __init__( + self, + *, + thumbprint: Optional[str] = None, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super(ApiPortalCustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = thumbprint + + +class Resource(msrest.serialization.Model): + """The core properties of ARM resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class ApiPortalCustomDomainResource(ProxyResource): + """Custom domain of the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: The properties of custom domain for API portal. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainProperties + """ + + _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': 'ApiPortalCustomDomainProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ApiPortalCustomDomainProperties"] = None, + **kwargs + ): + """ + :keyword properties: The properties of custom domain for API portal. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainProperties + """ + super(ApiPortalCustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class ApiPortalCustomDomainResourceCollection(msrest.serialization.Model): + """Object that includes an array of API portal custom domain resources and a possible link for next set. + + :ivar value: Collection of API portal custom domain resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApiPortalCustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApiPortalCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of API portal custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ApiPortalCustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalInstance(msrest.serialization.Model): + """Collection of instances belong to the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the API portal instance. + :vartype name: str + :ivar status: Status of the API portal instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApiPortalInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ApiPortalProperties(msrest.serialization.Model): + """API portal properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the API portal. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProvisioningState + :ivar public: Indicates whether the API portal exposes endpoint. + :vartype public: bool + :ivar url: URL of the API portal, exposed when 'public' is true. + :vartype url: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :vartype gateway_ids: list[str] + :ivar source_urls: Collection of OpenAPI source URL locations. + :vartype source_urls: list[str] + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResourceRequests + :ivar instances: Collection of instances belong to API portal. + :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'url': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'gateway_ids': {'key': 'gatewayIds', 'type': '[str]'}, + 'source_urls': {'key': 'sourceUrls', 'type': '[str]'}, + 'sso_properties': {'key': 'ssoProperties', 'type': 'SsoProperties'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ApiPortalResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ApiPortalInstance]'}, + } + + def __init__( + self, + *, + public: Optional[bool] = False, + https_only: Optional[bool] = False, + gateway_ids: Optional[List[str]] = None, + source_urls: Optional[List[str]] = None, + sso_properties: Optional["SsoProperties"] = None, + **kwargs + ): + """ + :keyword public: Indicates whether the API portal exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :paramtype gateway_ids: list[str] + :keyword source_urls: Collection of OpenAPI source URL locations. + :paramtype source_urls: list[str] + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties + """ + super(ApiPortalProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.public = public + self.url = None + self.https_only = https_only + self.gateway_ids = gateway_ids + self.source_urls = source_urls + self.sso_properties = sso_properties + self.resource_requests = None + self.instances = None + + +class ApiPortalResource(ProxyResource): + """API portal 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: API portal properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProperties + :ivar sku: Sku of the API portal resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + + _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': 'ApiPortalProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + properties: Optional["ApiPortalProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword properties: API portal properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProperties + :keyword sku: Sku of the API portal resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + super(ApiPortalResource, self).__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class ApiPortalResourceCollection(msrest.serialization.Model): + """Object that includes an array of API portal resources and a possible link for next set. + + :ivar value: Collection of API portal resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApiPortalResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApiPortalResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of API portal resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ApiPortalResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ApiPortalResourceRequests(msrest.serialization.Model): + """Resource requests of the API portal. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each API portal instance. + :vartype cpu: str + :ivar memory: Memory allocated to each API portal instance. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApiPortalResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + + +class ApplicationInsightsAgentVersions(msrest.serialization.Model): + """Application Insights agent versions properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar java: Indicates the version of application insight java agent. + :vartype java: str + """ + + _validation = { + 'java': {'readonly': True}, + } + + _attribute_map = { + 'java': {'key': 'java', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) + self.java = None + + +class AppResource(ProxyResource): + """App resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the App resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProperties + :ivar identity: The Managed Identity type of the app resource. + :vartype identity: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityProperties + :ivar location: The GEO location of the application, always the same with its parent resource. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'AppResourceProperties'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentityProperties'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + properties: Optional["AppResourceProperties"] = None, + identity: Optional["ManagedIdentityProperties"] = None, + location: Optional[str] = None, + **kwargs + ): + """ + :keyword properties: Properties of the App resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProperties + :keyword identity: The Managed Identity type of the app resource. + :paramtype identity: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityProperties + :keyword location: The GEO location of the application, always the same with its parent + resource. + :paramtype location: str + """ + super(AppResource, self).__init__(**kwargs) + self.properties = properties + self.identity = identity + self.location = location + + +class AppResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of App resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AppResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["AppResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of App resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(AppResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AppResourceProperties(msrest.serialization.Model): + """App resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public: Indicates whether the App exposes public endpoint. + :vartype public: bool + :ivar url: URL of the App. + :vartype url: str + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] + :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", + "Failed", "Creating", "Updating", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProvisioningState + :ivar fqdn: Fully qualified dns Name. + :vartype fqdn: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar temporary_disk: Temporary disk settings. + :vartype temporary_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TemporaryDisk + :ivar persistent_disk: Persistent disk settings. + :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.PersistentDisk + :ivar custom_persistent_disks: List of custom persistent disks. + :vartype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskResource] + :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :vartype enable_end_to_end_tls: bool + :ivar loaded_certificates: Collection of loaded certificates. + :vartype loaded_certificates: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LoadedCertificate] + :ivar vnet_addons: Additional App settings in vnet injection instance. + :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppVNetAddons + """ + + _validation = { + 'url': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'temporary_disk': {'key': 'temporaryDisk', 'type': 'TemporaryDisk'}, + 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, + 'custom_persistent_disks': {'key': 'customPersistentDisks', 'type': '[CustomPersistentDiskResource]'}, + 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, + 'loaded_certificates': {'key': 'loadedCertificates', 'type': '[LoadedCertificate]'}, + 'vnet_addons': {'key': 'vnetAddons', 'type': 'AppVNetAddons'}, + } + + def __init__( + self, + *, + public: Optional[bool] = None, + addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, + fqdn: Optional[str] = None, + https_only: Optional[bool] = False, + temporary_disk: Optional["TemporaryDisk"] = None, + persistent_disk: Optional["PersistentDisk"] = None, + custom_persistent_disks: Optional[List["CustomPersistentDiskResource"]] = None, + enable_end_to_end_tls: Optional[bool] = False, + loaded_certificates: Optional[List["LoadedCertificate"]] = None, + vnet_addons: Optional["AppVNetAddons"] = None, + **kwargs + ): + """ + :keyword public: Indicates whether the App exposes public endpoint. + :paramtype public: bool + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + :keyword fqdn: Fully qualified dns Name. + :paramtype fqdn: str + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword temporary_disk: Temporary disk settings. + :paramtype temporary_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TemporaryDisk + :keyword persistent_disk: Persistent disk settings. + :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.PersistentDisk + :keyword custom_persistent_disks: List of custom persistent disks. + :paramtype custom_persistent_disks: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskResource] + :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :paramtype enable_end_to_end_tls: bool + :keyword loaded_certificates: Collection of loaded certificates. + :paramtype loaded_certificates: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LoadedCertificate] + :keyword vnet_addons: Additional App settings in vnet injection instance. + :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppVNetAddons + """ + super(AppResourceProperties, self).__init__(**kwargs) + self.public = public + self.url = None + self.addon_configs = addon_configs + self.provisioning_state = None + self.fqdn = fqdn + self.https_only = https_only + self.temporary_disk = temporary_disk + self.persistent_disk = persistent_disk + self.custom_persistent_disks = custom_persistent_disks + self.enable_end_to_end_tls = enable_end_to_end_tls + self.loaded_certificates = loaded_certificates + self.vnet_addons = vnet_addons + + +class AppVNetAddons(msrest.serialization.Model): + """Additional App settings in vnet injection instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint + which could be accessed from internet. + :vartype public_endpoint: bool + :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed + from internet. + :vartype public_endpoint_url: str + """ + + _validation = { + 'public_endpoint_url': {'readonly': True}, + } + + _attribute_map = { + 'public_endpoint': {'key': 'publicEndpoint', 'type': 'bool'}, + 'public_endpoint_url': {'key': 'publicEndpointUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + public_endpoint: Optional[bool] = False, + **kwargs + ): + """ + :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint + which could be accessed from internet. + :paramtype public_endpoint: bool + """ + super(AppVNetAddons, self).__init__(**kwargs) + self.public_endpoint = public_endpoint + self.public_endpoint_url = None + + +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDetail"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(AvailableOperations, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AvailableRuntimeVersions(msrest.serialization.Model): + """AvailableRuntimeVersions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A list of all supported runtime versions. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeVersion] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(AvailableRuntimeVersions, self).__init__(**kwargs) + self.value = None + + +class CustomPersistentDiskProperties(msrest.serialization.Model): + """Custom persistent disk resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AzureFileVolume. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.Type + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + """ + + _validation = { + 'type': {'required': True}, + 'mount_path': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + 'read_only': {'key': 'readOnly', 'type': 'bool'}, + 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, + } + + _subtype_map = { + 'type': {'AzureFileVolume': 'AzureFileVolume'} + } + + def __init__( + self, + *, + mount_path: str, + read_only: Optional[bool] = None, + mount_options: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + """ + super(CustomPersistentDiskProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.mount_path = mount_path + self.read_only = read_only + self.mount_options = mount_options + + +class AzureFileVolume(CustomPersistentDiskProperties): + """The properties of the Azure File volume. Azure File shares are mounted as volumes. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. Possible values include: "AzureFileVolume". + :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.Type + :ivar mount_path: Required. The mount path of the persistent disk. + :vartype mount_path: str + :ivar read_only: Indicates whether the persistent disk is a readOnly one. + :vartype read_only: bool + :ivar mount_options: These are the mount options for a persistent disk. + :vartype mount_options: list[str] + :ivar share_name: Required. The share name of the Azure File share. + :vartype share_name: str + """ + + _validation = { + 'type': {'required': True}, + 'mount_path': {'required': True}, + 'share_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + 'read_only': {'key': 'readOnly', 'type': 'bool'}, + 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, + 'share_name': {'key': 'shareName', 'type': 'str'}, + } + + def __init__( + self, + *, + mount_path: str, + share_name: str, + read_only: Optional[bool] = None, + mount_options: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword mount_path: Required. The mount path of the persistent disk. + :paramtype mount_path: str + :keyword read_only: Indicates whether the persistent disk is a readOnly one. + :paramtype read_only: bool + :keyword mount_options: These are the mount options for a persistent disk. + :paramtype mount_options: list[str] + :keyword share_name: Required. The share name of the Azure File share. + :paramtype share_name: str + """ + super(AzureFileVolume, self).__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) + self.type = 'AzureFileVolume' # type: str + self.share_name = share_name + + +class BindingResource(ProxyResource): + """Binding resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the Binding resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceProperties + """ + + _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': 'BindingResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BindingResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Binding resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceProperties + """ + super(BindingResource, self).__init__(**kwargs) + self.properties = properties + + +class BindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of Binding resources and a possible link for next set. + + :ivar value: Collection of Binding resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Binding resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BindingResourceProperties(msrest.serialization.Model): + """Binding resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_name: The name of the bound resource. + :vartype resource_name: str + :ivar resource_type: The standard Azure resource type of the bound resource. + :vartype resource_type: str + :ivar resource_id: The Azure resource id of the bound resource. + :vartype resource_id: str + :ivar key: The key of the bound resource. + :vartype key: str + :ivar binding_parameters: Binding parameters of the Binding resource. + :vartype binding_parameters: dict[str, any] + :ivar generated_properties: The generated Spring Boot property file for this binding. The + secret will be deducted. + :vartype generated_properties: str + :ivar created_at: Creation time of the Binding resource. + :vartype created_at: str + :ivar updated_at: Update time of the Binding resource. + :vartype updated_at: str + """ + + _validation = { + 'resource_name': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'generated_properties': {'readonly': True}, + 'created_at': {'readonly': True}, + 'updated_at': {'readonly': True}, + } + + _attribute_map = { + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'str'}, + 'binding_parameters': {'key': 'bindingParameters', 'type': '{object}'}, + 'generated_properties': {'key': 'generatedProperties', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'str'}, + 'updated_at': {'key': 'updatedAt', 'type': 'str'}, + } + + def __init__( + self, + *, + resource_id: Optional[str] = None, + key: Optional[str] = None, + binding_parameters: Optional[Dict[str, Any]] = None, + **kwargs + ): + """ + :keyword resource_id: The Azure resource id of the bound resource. + :paramtype resource_id: str + :keyword key: The key of the bound resource. + :paramtype key: str + :keyword binding_parameters: Binding parameters of the Binding resource. + :paramtype binding_parameters: dict[str, any] + """ + super(BindingResourceProperties, self).__init__(**kwargs) + self.resource_name = None + self.resource_type = None + self.resource_id = resource_id + self.key = key + self.binding_parameters = binding_parameters + self.generated_properties = None + self.created_at = None + self.updated_at = None + + +class Build(ProxyResource): + """Build resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildProperties + """ + + _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': 'BuildProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildProperties + """ + super(Build, self).__init__(**kwargs) + self.properties = properties + + +class BuildCollection(msrest.serialization.Model): + """Object that includes an array of Build resources and a possible link for next set. + + :ivar value: Collection of Build resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.Build] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Build]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Build"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.Build] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuilderProperties(msrest.serialization.Model): + """KPack Builder properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Builder provision status. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProvisioningState + :ivar stack: Builder cluster stack property. + :vartype stack: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StackProperties + :ivar buildpack_groups: Builder buildpack groups. + :vartype buildpack_groups: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpacksGroupProperties] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'stack': {'key': 'stack', 'type': 'StackProperties'}, + 'buildpack_groups': {'key': 'buildpackGroups', 'type': '[BuildpacksGroupProperties]'}, + } + + def __init__( + self, + *, + stack: Optional["StackProperties"] = None, + buildpack_groups: Optional[List["BuildpacksGroupProperties"]] = None, + **kwargs + ): + """ + :keyword stack: Builder cluster stack property. + :paramtype stack: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StackProperties + :keyword buildpack_groups: Builder buildpack groups. + :paramtype buildpack_groups: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpacksGroupProperties] + """ + super(BuilderProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.stack = stack + self.buildpack_groups = buildpack_groups + + +class BuilderResource(ProxyResource): + """KPack Builder 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Property of the Builder resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProperties + """ + + _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': 'BuilderProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuilderProperties"] = None, + **kwargs + ): + """ + :keyword properties: Property of the Builder resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProperties + """ + super(BuilderResource, self).__init__(**kwargs) + self.properties = properties + + +class BuilderResourceCollection(msrest.serialization.Model): + """Object that includes an array of Builder resources and a possible link for next set. + + :ivar value: Collection of Builder resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuilderResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuilderResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Builder resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuilderResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackBindingLaunchProperties(msrest.serialization.Model): + """Buildpack Binding Launch Properties. + + :ivar properties: Non-sensitive properties for launchProperties. + :vartype properties: dict[str, str] + :ivar secrets: Sensitive properties for launchProperties. + :vartype secrets: dict[str, str] + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': '{str}'}, + 'secrets': {'key': 'secrets', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: Optional[Dict[str, str]] = None, + secrets: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword properties: Non-sensitive properties for launchProperties. + :paramtype properties: dict[str, str] + :keyword secrets: Sensitive properties for launchProperties. + :paramtype secrets: dict[str, str] + """ + super(BuildpackBindingLaunchProperties, self).__init__(**kwargs) + self.properties = properties + self.secrets = secrets + + +class BuildpackBindingProperties(msrest.serialization.Model): + """Properties of a buildpack binding. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". + :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingType + :ivar provisioning_state: State of the Buildpack Binding. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProvisioningState + :ivar launch_properties: The object describes the buildpack binding launch properties. + :vartype launch_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingLaunchProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'binding_type': {'key': 'bindingType', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'launch_properties': {'key': 'launchProperties', 'type': 'BuildpackBindingLaunchProperties'}, + } + + def __init__( + self, + *, + binding_type: Optional[Union[str, "BindingType"]] = None, + launch_properties: Optional["BuildpackBindingLaunchProperties"] = None, + **kwargs + ): + """ + :keyword binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". + :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingType + :keyword launch_properties: The object describes the buildpack binding launch properties. + :paramtype launch_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingLaunchProperties + """ + super(BuildpackBindingProperties, self).__init__(**kwargs) + self.binding_type = binding_type + self.provisioning_state = None + self.launch_properties = launch_properties + + +class BuildpackBindingResource(ProxyResource): + """Buildpack Binding Resource object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of a buildpack binding. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProperties + """ + + _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': 'BuildpackBindingProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildpackBindingProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of a buildpack binding. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProperties + """ + super(BuildpackBindingResource, self).__init__(**kwargs) + self.properties = properties + + +class BuildpackBindingResourceCollection(msrest.serialization.Model): + """Object that includes an array of BuildpackBinding resources and a possible link for next set. + + :ivar value: Collection of BuildpackBinding resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildpackBindingResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildpackBindingResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of BuildpackBinding resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildpackBindingResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildpackProperties(msrest.serialization.Model): + """Buildpack properties payload. + + :ivar id: Id of the buildpack. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Id of the buildpack. + :paramtype id: str + """ + super(BuildpackProperties, self).__init__(**kwargs) + self.id = id + + +class BuildpacksGroupProperties(msrest.serialization.Model): + """Buildpack group properties of the Builder. + + :ivar name: Buildpack group name. + :vartype name: str + :ivar buildpacks: Buildpacks in the buildpack group. + :vartype buildpacks: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackProperties] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'buildpacks': {'key': 'buildpacks', 'type': '[BuildpackProperties]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + buildpacks: Optional[List["BuildpackProperties"]] = None, + **kwargs + ): + """ + :keyword name: Buildpack group name. + :paramtype name: str + :keyword buildpacks: Buildpacks in the buildpack group. + :paramtype buildpacks: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackProperties] + """ + super(BuildpacksGroupProperties, self).__init__(**kwargs) + self.name = name + self.buildpacks = buildpacks + + +class BuildProperties(msrest.serialization.Model): + """Build resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar relative_path: The relative path of source code. + :vartype relative_path: str + :ivar builder: The resource id of builder to build the source code. + :vartype builder: str + :ivar agent_pool: The resource id of agent pool. + :vartype agent_pool: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildProvisioningState + :ivar env: The environment variables for this build. + :vartype env: dict[str, str] + :ivar triggered_build_result: The build result triggered by this build. + :vartype triggered_build_result: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.TriggeredBuildResult + :ivar resource_requests: The customized build resource for this build. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResourceRequests + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'triggered_build_result': {'readonly': True}, + } + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'builder': {'key': 'builder', 'type': 'str'}, + 'agent_pool': {'key': 'agentPool', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'env': {'key': 'env', 'type': '{str}'}, + 'triggered_build_result': {'key': 'triggeredBuildResult', 'type': 'TriggeredBuildResult'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'BuildResourceRequests'}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + builder: Optional[str] = None, + agent_pool: Optional[str] = None, + env: Optional[Dict[str, str]] = None, + resource_requests: Optional["BuildResourceRequests"] = None, + **kwargs + ): + """ + :keyword relative_path: The relative path of source code. + :paramtype relative_path: str + :keyword builder: The resource id of builder to build the source code. + :paramtype builder: str + :keyword agent_pool: The resource id of agent pool. + :paramtype agent_pool: str + :keyword env: The environment variables for this build. + :paramtype env: dict[str, str] + :keyword resource_requests: The customized build resource for this build. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResourceRequests + """ + super(BuildProperties, self).__init__(**kwargs) + self.relative_path = relative_path + self.builder = builder + self.agent_pool = agent_pool + self.provisioning_state = None + self.env = env + self.triggered_build_result = None + self.resource_requests = resource_requests + + +class BuildResourceRequests(msrest.serialization.Model): + """Resource request payload of Build Resource. + + :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or + 1000m. + The default value is 1, this should not exceed build service agent pool cpu size. + :vartype cpu: str + :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi + or 1024Mi. + The default value is 2Gi, this should not exceed build service agent pool memory size. + :vartype memory: str + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + cpu: Optional[str] = "1", + memory: Optional[str] = "2Gi", + **kwargs + ): + """ + :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or + 1000m. + The default value is 1, this should not exceed build service agent pool cpu size. + :paramtype cpu: str + :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by + 1Gi or 1024Mi. + The default value is 2Gi, this should not exceed build service agent pool memory size. + :paramtype memory: str + """ + super(BuildResourceRequests, self).__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class BuildResult(ProxyResource): + """Build result resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the build result resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultProperties + """ + + _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': 'BuildResultProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildResultProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build result resource. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultProperties + """ + super(BuildResult, self).__init__(**kwargs) + self.properties = properties + + +class BuildResultCollection(msrest.serialization.Model): + """Object that includes an array of Build result resources and a possible link for next set. + + :ivar value: Collection of Build result resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildResult"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build result resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildResultCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildResultLog(msrest.serialization.Model): + """Build result log resource properties payload. + + :ivar blob_url: The public download URL of this build result log. + :vartype blob_url: str + """ + + _attribute_map = { + 'blob_url': {'key': 'blobUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + blob_url: Optional[str] = None, + **kwargs + ): + """ + :keyword blob_url: The public download URL of this build result log. + :paramtype blob_url: str + """ + super(BuildResultLog, self).__init__(**kwargs) + self.blob_url = blob_url + + +class BuildResultProperties(msrest.serialization.Model): + """Build result resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build result. + :vartype name: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Queuing", "Building", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultProvisioningState + :ivar build_pod_name: The build pod name which can be used to get the build log streaming. + :vartype build_pod_name: str + :ivar build_stages: All of the build stage (init-container and container) resources in build + pod. + :vartype build_stages: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildStageProperties] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'build_stages': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'build_pod_name': {'key': 'buildPodName', 'type': 'str'}, + 'build_stages': {'key': 'buildStages', 'type': '[BuildStageProperties]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + build_pod_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of this build result. + :paramtype name: str + :keyword build_pod_name: The build pod name which can be used to get the build log streaming. + :paramtype build_pod_name: str + """ + super(BuildResultProperties, self).__init__(**kwargs) + self.name = name + self.provisioning_state = None + self.build_pod_name = build_pod_name + self.build_stages = None + + +class UserSourceInfo(msrest.serialization.Model): + """Source information for a deployment. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: BuildResultUserSourceInfo, CustomContainerUserSourceInfo, UploadedUserSourceInfo. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'BuildResult': 'BuildResultUserSourceInfo', 'Container': 'CustomContainerUserSourceInfo', 'UploadedUserSourceInfo': 'UploadedUserSourceInfo'} + } + + def __init__( + self, + *, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + """ + super(UserSourceInfo, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.version = version + + +class BuildResultUserSourceInfo(UserSourceInfo): + """Reference to a build result. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring + instance. + :vartype build_result_id: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'build_result_id': {'key': 'buildResultId', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + build_result_id: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword build_result_id: Resource id of an existing succeeded build result under the same + Spring instance. + :paramtype build_result_id: str + """ + super(BuildResultUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'BuildResult' # type: str + self.build_result_id = build_result_id + + +class BuildService(ProxyResource): + """Build service resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the build resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProperties + """ + + _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': 'BuildServiceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildServiceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the build resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProperties + """ + super(BuildService, self).__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolProperties(msrest.serialization.Model): + """Build service agent pool properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the build service agent pool. + :vartype provisioning_state: str + :ivar pool_size: build service agent pool size properties. + :vartype pool_size: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolSizeProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'pool_size': {'key': 'poolSize', 'type': 'BuildServiceAgentPoolSizeProperties'}, + } + + def __init__( + self, + *, + pool_size: Optional["BuildServiceAgentPoolSizeProperties"] = None, + **kwargs + ): + """ + :keyword pool_size: build service agent pool size properties. + :paramtype pool_size: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolSizeProperties + """ + super(BuildServiceAgentPoolProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.pool_size = pool_size + + +class BuildServiceAgentPoolResource(ProxyResource): + """The build service agent pool 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: build service agent pool properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolProperties + """ + + _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': 'BuildServiceAgentPoolProperties'}, + } + + def __init__( + self, + *, + properties: Optional["BuildServiceAgentPoolProperties"] = None, + **kwargs + ): + """ + :keyword properties: build service agent pool properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolProperties + """ + super(BuildServiceAgentPoolResource, self).__init__(**kwargs) + self.properties = properties + + +class BuildServiceAgentPoolResourceCollection(msrest.serialization.Model): + """Object that includes an array of build service agent pool resources and a possible link for next set. + + :ivar value: Collection of build service agent pool resource. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildServiceAgentPoolResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildServiceAgentPoolResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of build service agent pool resource. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildServiceAgentPoolResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceAgentPoolSizeProperties(msrest.serialization.Model): + """Build service agent pool size properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of build service agent pool size. + :vartype name: str + :ivar cpu: The cpu property of build service agent pool size. + :vartype cpu: str + :ivar memory: The memory property of build service agent pool size. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of build service agent pool size. + :paramtype name: str + """ + super(BuildServiceAgentPoolSizeProperties, self).__init__(**kwargs) + self.name = name + self.cpu = None + self.memory = None + + +class BuildServiceCollection(msrest.serialization.Model): + """Object that includes an array of Build service resources and a possible link for next set. + + :ivar value: Collection of Build service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[BuildService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["BuildService"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Build service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(BuildServiceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class BuildServiceProperties(msrest.serialization.Model): + """Build service resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar k_pack_version: The installed KPack version in this build service. + :vartype k_pack_version: str + :ivar provisioning_state: Provisioning state of the KPack build result. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProvisioningState + :ivar resource_requests: The runtime resource configuration of this build service. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServicePropertiesResourceRequests + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'k_pack_version': {'key': 'kPackVersion', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'BuildServicePropertiesResourceRequests'}, + } + + def __init__( + self, + *, + k_pack_version: Optional[str] = None, + resource_requests: Optional["BuildServicePropertiesResourceRequests"] = None, + **kwargs + ): + """ + :keyword k_pack_version: The installed KPack version in this build service. + :paramtype k_pack_version: str + :keyword resource_requests: The runtime resource configuration of this build service. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServicePropertiesResourceRequests + """ + super(BuildServiceProperties, self).__init__(**kwargs) + self.k_pack_version = k_pack_version + self.provisioning_state = None + self.resource_requests = resource_requests + + +class BuildServicePropertiesResourceRequests(msrest.serialization.Model): + """The runtime resource configuration of this build service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: vCPU allocated to the entire build service node pool. + :vartype cpu: str + :ivar memory: Memory allocated to the entire build service node pool. + :vartype memory: str + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BuildServicePropertiesResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + + +class BuildStageProperties(msrest.serialization.Model): + """The build stage (init-container and container) resources in build pod. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The name of this build stage resource. + :vartype name: str + :ivar status: The provisioning state of this build stage resource. Possible values include: + "NotStarted", "Running", "Succeeded", "Failed". + :vartype status: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.KPackBuildStageProvisioningState + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(BuildStageProperties, self).__init__(**kwargs) + self.name = None + self.status = None + + +class CertificateProperties(msrest.serialization.Model): + """Certificate resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ContentCertificateProperties, KeyVaultCertificateProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar provisioning_state: Provisioning state of the Certificate. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'ContentCertificate': 'ContentCertificateProperties', 'KeyVaultCertificate': 'KeyVaultCertificateProperties'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CertificateProperties, self).__init__(**kwargs) + self.type = None # type: Optional[str] + self.thumbprint = None + self.issuer = None + self.issued_date = None + self.expiration_date = None + self.activate_date = None + self.subject_name = None + self.dns_names = None + self.provisioning_state = None + + +class CertificateResource(ProxyResource): + """Certificate resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the certificate resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateProperties + """ + + _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': 'CertificateProperties'}, + } + + def __init__( + self, + *, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the certificate resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateProperties + """ + super(CertificateResource, self).__init__(**kwargs) + self.properties = properties + + +class CertificateResourceCollection(msrest.serialization.Model): + """Collection compose of certificate resources list and a possible link for next page. + + :ivar value: The certificate resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] + :ivar next_link: The link to next page of certificate list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CertificateResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The certificate resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] + :keyword next_link: The link to next page of certificate list. + :paramtype next_link: str + """ + super(CertificateResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from the service. + + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in + error. + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CloudErrorBody] + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class ClusterResourceProperties(msrest.serialization.Model): + """Service properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the Service. Possible values include: + "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", + "Moving", "Moved", "MoveFailed". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProvisioningState + :ivar network_profile: Network profile of the Service. + :vartype network_profile: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfile + :ivar vnet_addons: Additional Service settings in vnet injection instance. + :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceVNetAddons + :ivar version: Version of the Service. + :vartype version: int + :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. + :vartype service_id: str + :ivar power_state: Power state of the Service. Possible values include: "Running", "Stopped". + :vartype power_state: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.PowerState + :ivar zone_redundant: + :vartype zone_redundant: bool + :ivar fqdn: Fully qualified dns name of the service instance. + :vartype fqdn: str + :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. + :vartype marketplace_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MarketplaceResource + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'version': {'readonly': True}, + 'service_id': {'readonly': True}, + 'power_state': {'readonly': True}, + 'fqdn': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfile'}, + 'vnet_addons': {'key': 'vnetAddons', 'type': 'ServiceVNetAddons'}, + 'version': {'key': 'version', 'type': 'int'}, + 'service_id': {'key': 'serviceId', 'type': 'str'}, + 'power_state': {'key': 'powerState', 'type': 'str'}, + 'zone_redundant': {'key': 'zoneRedundant', 'type': 'bool'}, + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'marketplace_resource': {'key': 'marketplaceResource', 'type': 'MarketplaceResource'}, + } + + def __init__( + self, + *, + network_profile: Optional["NetworkProfile"] = None, + vnet_addons: Optional["ServiceVNetAddons"] = None, + zone_redundant: Optional[bool] = False, + marketplace_resource: Optional["MarketplaceResource"] = None, + **kwargs + ): + """ + :keyword network_profile: Network profile of the Service. + :paramtype network_profile: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfile + :keyword vnet_addons: Additional Service settings in vnet injection instance. + :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceVNetAddons + :keyword zone_redundant: + :paramtype zone_redundant: bool + :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. + :paramtype marketplace_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MarketplaceResource + """ + super(ClusterResourceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.network_profile = network_profile + self.vnet_addons = vnet_addons + self.version = None + self.service_id = None + self.power_state = None + self.zone_redundant = zone_redundant + self.fqdn = None + self.marketplace_resource = marketplace_resource + + +class ConfigServerGitProperty(msrest.serialization.Model): + """Property of git. + + All required parameters must be populated in order to send to Azure. + + :ivar repositories: Repositories of git. + :vartype repositories: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GitPatternRepository] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'uri': {'required': True}, + } + + _attribute_map = { + 'repositories': {'key': 'repositories', 'type': '[GitPatternRepository]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + *, + uri: str, + repositories: Optional[List["GitPatternRepository"]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): + """ + :keyword repositories: Repositories of git. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GitPatternRepository] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(ConfigServerGitProperty, self).__init__(**kwargs) + self.repositories = repositories + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class ConfigServerProperties(msrest.serialization.Model): + """Config server git properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", + "Deleted", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerState + :ivar error: Error when apply config server settings. + :vartype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error + :ivar config_server: Settings of config server. + :vartype config_server: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, + } + + def __init__( + self, + *, + error: Optional["Error"] = None, + config_server: Optional["ConfigServerSettings"] = None, + **kwargs + ): + """ + :keyword error: Error when apply config server settings. + :paramtype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error + :keyword config_server: Settings of config server. + :paramtype config_server: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings + """ + super(ConfigServerProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.config_server = config_server + + +class ConfigServerResource(ProxyResource): + """Config Server 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the Config Server resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerProperties + """ + + _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': 'ConfigServerProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ConfigServerProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Config Server resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerProperties + """ + super(ConfigServerResource, self).__init__(**kwargs) + self.properties = properties + + +class ConfigServerSettings(msrest.serialization.Model): + """The settings of config server. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerGitProperty + """ + + _attribute_map = { + 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, + } + + def __init__( + self, + *, + git_property: Optional["ConfigServerGitProperty"] = None, + **kwargs + ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerGitProperty + """ + super(ConfigServerSettings, self).__init__(**kwargs) + self.git_property = git_property + + +class ConfigServerSettingsErrorRecord(msrest.serialization.Model): + """Error record of the config server settings. + + :ivar name: The name of the config server settings error record. + :vartype name: str + :ivar uri: The uri of the config server settings error record. + :vartype uri: str + :ivar messages: The detail error messages of the record. + :vartype messages: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'messages': {'key': 'messages', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + uri: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword name: The name of the config server settings error record. + :paramtype name: str + :keyword uri: The uri of the config server settings error record. + :paramtype uri: str + :keyword messages: The detail error messages of the record. + :paramtype messages: list[str] + """ + super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) + self.name = name + self.uri = uri + self.messages = messages + + +class ConfigServerSettingsValidateResult(msrest.serialization.Model): + """Validation result for config server settings. + + :ivar is_valid: Indicate if the config server settings are valid. + :vartype is_valid: bool + :ivar details: The detail validation results. + :vartype details: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsErrorRecord] + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, + **kwargs + ): + """ + :keyword is_valid: Indicate if the config server settings are valid. + :paramtype is_valid: bool + :keyword details: The detail validation results. + :paramtype details: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsErrorRecord] + """ + super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.details = details + + +class ConfigurationServiceGitProperty(msrest.serialization.Model): + """Property of git environment. + + :ivar repositories: Repositories of Application Configuration Service git property. + :vartype repositories: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitRepository] + """ + + _attribute_map = { + 'repositories': {'key': 'repositories', 'type': '[ConfigurationServiceGitRepository]'}, + } + + def __init__( + self, + *, + repositories: Optional[List["ConfigurationServiceGitRepository"]] = None, + **kwargs + ): + """ + :keyword repositories: Repositories of Application Configuration Service git property. + :paramtype repositories: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitRepository] + """ + super(ConfigurationServiceGitProperty, self).__init__(**kwargs) + self.repositories = repositories + + +class ConfigurationServiceGitPropertyValidateResult(msrest.serialization.Model): + """Validation result for configuration service settings. + + :ivar is_valid: Indicate if the configuration service settings are valid. + :vartype is_valid: bool + :ivar git_repos_validation_result: The detail validation results. + :vartype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ValidationMessages] + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'git_repos_validation_result': {'key': 'gitReposValidationResult', 'type': '[ValidationMessages]'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + git_repos_validation_result: Optional[List["ValidationMessages"]] = None, + **kwargs + ): + """ + :keyword is_valid: Indicate if the configuration service settings are valid. + :paramtype is_valid: bool + :keyword git_repos_validation_result: The detail validation results. + :paramtype git_repos_validation_result: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ValidationMessages] + """ + super(ConfigurationServiceGitPropertyValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.git_repos_validation_result = git_repos_validation_result + + +class ConfigurationServiceGitRepository(msrest.serialization.Model): + """Git repository property payload for Application Configuration Service. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar patterns: Required. Collection of patterns of the repository. + :vartype patterns: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Required. Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'name': {'required': True}, + 'patterns': {'required': True}, + 'uri': {'required': True}, + 'label': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'patterns': {'key': 'patterns', 'type': '[str]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + patterns: List[str], + uri: str, + label: str, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword patterns: Required. Collection of patterns of the repository. + :paramtype patterns: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Required. Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(ConfigurationServiceGitRepository, self).__init__(**kwargs) + self.name = name + self.patterns = patterns + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class ConfigurationServiceInstance(msrest.serialization.Model): + """Collection of instances belong to the Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Application Configuration Service instance. + :vartype name: str + :ivar status: Status of the Application Configuration Service instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConfigurationServiceInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ConfigurationServiceProperties(msrest.serialization.Model): + """Application Configuration Service properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Application Configuration Service. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResourceRequests + :ivar instances: Collection of instances belong to Application Configuration Service. + :vartype instances: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceInstance] + :ivar settings: The settings of Application Configuration Service. + :vartype settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ConfigurationServiceResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ConfigurationServiceInstance]'}, + 'settings': {'key': 'settings', 'type': 'ConfigurationServiceSettings'}, + } + + def __init__( + self, + *, + settings: Optional["ConfigurationServiceSettings"] = None, + **kwargs + ): + """ + :keyword settings: The settings of Application Configuration Service. + :paramtype settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings + """ + super(ConfigurationServiceProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.resource_requests = None + self.instances = None + self.settings = settings + + +class ConfigurationServiceResource(ProxyResource): + """Application Configuration Service 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Application Configuration Service properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProperties + """ + + _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': 'ConfigurationServiceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ConfigurationServiceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Application Configuration Service properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProperties + """ + super(ConfigurationServiceResource, self).__init__(**kwargs) + self.properties = properties + + +class ConfigurationServiceResourceCollection(msrest.serialization.Model): + """Object that includes an array of configuration service resources and a possible link for next set. + + :ivar value: Collection of configuration service resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ConfigurationServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ConfigurationServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of configuration service resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ConfigurationServiceResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ConfigurationServiceResourceRequests(msrest.serialization.Model): + """Resource request payload of Application Configuration Service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Application Configuration Service instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Application Configuration Service instance. + :vartype memory: str + :ivar instance_count: Instance count of the Application Configuration Service. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ConfigurationServiceResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class ConfigurationServiceSettings(msrest.serialization.Model): + """The settings of Application Configuration Service. + + :ivar git_property: Property of git environment. + :vartype git_property: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitProperty + """ + + _attribute_map = { + 'git_property': {'key': 'gitProperty', 'type': 'ConfigurationServiceGitProperty'}, + } + + def __init__( + self, + *, + git_property: Optional["ConfigurationServiceGitProperty"] = None, + **kwargs + ): + """ + :keyword git_property: Property of git environment. + :paramtype git_property: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitProperty + """ + super(ConfigurationServiceSettings, self).__init__(**kwargs) + self.git_property = git_property + + +class ConfigurationServiceSettingsValidateResult(msrest.serialization.Model): + """Validation result for configuration service settings. + + :ivar git_property_validation_result: Validation result for configuration service settings. + :vartype git_property_validation_result: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult + """ + + _attribute_map = { + 'git_property_validation_result': {'key': 'gitPropertyValidationResult', 'type': 'ConfigurationServiceGitPropertyValidateResult'}, + } + + def __init__( + self, + *, + git_property_validation_result: Optional["ConfigurationServiceGitPropertyValidateResult"] = None, + **kwargs + ): + """ + :keyword git_property_validation_result: Validation result for configuration service settings. + :paramtype git_property_validation_result: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult + """ + super(ConfigurationServiceSettingsValidateResult, self).__init__(**kwargs) + self.git_property_validation_result = git_property_validation_result + + +class ContainerProbeSettings(msrest.serialization.Model): + """Container liveness and readiness probe settings. + + :ivar disable_probe: Indicates whether disable the liveness and readiness probe. + :vartype disable_probe: bool + """ + + _attribute_map = { + 'disable_probe': {'key': 'disableProbe', 'type': 'bool'}, + } + + def __init__( + self, + *, + disable_probe: Optional[bool] = None, + **kwargs + ): + """ + :keyword disable_probe: Indicates whether disable the liveness and readiness probe. + :paramtype disable_probe: bool + """ + super(ContainerProbeSettings, self).__init__(**kwargs) + self.disable_probe = disable_probe + + +class ContentCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar provisioning_state: Provisioning state of the Certificate. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState + :ivar content: The content of uploaded certificate. + :vartype content: str + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + } + + def __init__( + self, + *, + content: Optional[str] = None, + **kwargs + ): + """ + :keyword content: The content of uploaded certificate. + :paramtype content: str + """ + super(ContentCertificateProperties, self).__init__(**kwargs) + self.type = 'ContentCertificate' # type: str + self.content = content + + +class CustomContainer(msrest.serialization.Model): + """Custom container payload. + + :ivar server: The name of the registry that contains the container image. + :vartype server: str + :ivar container_image: Container image of the custom container. This should be in the form of + :code:``::code:`` without the server name of the registry. + :vartype container_image: str + :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + used if this is not provided. + :vartype command: list[str] + :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :vartype args: list[str] + :ivar image_registry_credential: Credential of the image registry. + :vartype image_registry_credential: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ImageRegistryCredential + :ivar language_framework: Language framework of the container image uploaded. + :vartype language_framework: str + """ + + _attribute_map = { + 'server': {'key': 'server', 'type': 'str'}, + 'container_image': {'key': 'containerImage', 'type': 'str'}, + 'command': {'key': 'command', 'type': '[str]'}, + 'args': {'key': 'args', 'type': '[str]'}, + 'image_registry_credential': {'key': 'imageRegistryCredential', 'type': 'ImageRegistryCredential'}, + 'language_framework': {'key': 'languageFramework', 'type': 'str'}, + } + + def __init__( + self, + *, + server: Optional[str] = None, + container_image: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + image_registry_credential: Optional["ImageRegistryCredential"] = None, + language_framework: Optional[str] = None, + **kwargs + ): + """ + :keyword server: The name of the registry that contains the container image. + :paramtype server: str + :keyword container_image: Container image of the custom container. This should be in the form + of :code:``::code:`` without the server name of the registry. + :paramtype container_image: str + :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT + is used if this is not provided. + :paramtype command: list[str] + :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not + provided. + :paramtype args: list[str] + :keyword image_registry_credential: Credential of the image registry. + :paramtype image_registry_credential: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ImageRegistryCredential + :keyword language_framework: Language framework of the container image uploaded. + :paramtype language_framework: str + """ + super(CustomContainer, self).__init__(**kwargs) + self.server = server + self.container_image = container_image + self.command = command + self.args = args + self.image_registry_credential = image_registry_credential + self.language_framework = language_framework + + +class CustomContainerUserSourceInfo(UserSourceInfo): + """Custom container user source info. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar custom_container: Custom container payload. + :vartype custom_container: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomContainer + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'custom_container': {'key': 'customContainer', 'type': 'CustomContainer'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + custom_container: Optional["CustomContainer"] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword custom_container: Custom container payload. + :paramtype custom_container: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomContainer + """ + super(CustomContainerUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'Container' # type: str + self.custom_container = custom_container + + +class CustomDomainProperties(msrest.serialization.Model): + """Custom domain of app resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + :ivar app_name: The app name of domain. + :vartype app_name: str + :ivar cert_name: The bound certificate name of domain. + :vartype cert_name: str + :ivar provisioning_state: Provisioning state of the Domain. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResourceProvisioningState + """ + + _validation = { + 'app_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'app_name': {'key': 'appName', 'type': 'str'}, + 'cert_name': {'key': 'certName', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + thumbprint: Optional[str] = None, + cert_name: Optional[str] = None, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + :keyword cert_name: The bound certificate name of domain. + :paramtype cert_name: str + """ + super(CustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = thumbprint + self.app_name = None + self.cert_name = cert_name + self.provisioning_state = None + + +class CustomDomainResource(ProxyResource): + """Custom domain resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the custom domain resource. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainProperties + """ + + _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': 'CustomDomainProperties'}, + } + + def __init__( + self, + *, + properties: Optional["CustomDomainProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the custom domain resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainProperties + """ + super(CustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class CustomDomainResourceCollection(msrest.serialization.Model): + """Collection compose of a custom domain resources list and a possible link for next page. + + :ivar value: The custom domain resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] + :ivar next_link: The link to next page of custom domain list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["CustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The custom domain resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] + :keyword next_link: The link to next page of custom domain list. + :paramtype next_link: str + """ + super(CustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CustomDomainValidatePayload(msrest.serialization.Model): + """Custom domain validate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name to be validated. + :vartype name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. Name to be validated. + :paramtype name: str + """ + super(CustomDomainValidatePayload, self).__init__(**kwargs) + self.name = name + + +class CustomDomainValidateResult(msrest.serialization.Model): + """Validation result for custom domain. + + :ivar is_valid: Indicates if domain name is valid. + :vartype is_valid: bool + :ivar message: Message of why domain name is invalid. + :vartype message: str + """ + + _attribute_map = { + 'is_valid': {'key': 'isValid', 'type': 'bool'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + is_valid: Optional[bool] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword is_valid: Indicates if domain name is valid. + :paramtype is_valid: bool + :keyword message: Message of why domain name is invalid. + :paramtype message: str + """ + super(CustomDomainValidateResult, self).__init__(**kwargs) + self.is_valid = is_valid + self.message = message + + +class CustomPersistentDiskResource(msrest.serialization.Model): + """Custom persistent disk resource payload. + + All required parameters must be populated in order to send to Azure. + + :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :vartype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskProperties + :ivar storage_id: Required. The resource id of Azure Spring Apps Storage resource. + :vartype storage_id: str + """ + + _validation = { + 'storage_id': {'required': True}, + } + + _attribute_map = { + 'custom_persistent_disk_properties': {'key': 'customPersistentDiskProperties', 'type': 'CustomPersistentDiskProperties'}, + 'storage_id': {'key': 'storageId', 'type': 'str'}, + } + + def __init__( + self, + *, + storage_id: str, + custom_persistent_disk_properties: Optional["CustomPersistentDiskProperties"] = None, + **kwargs + ): + """ + :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource + payload. + :paramtype custom_persistent_disk_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskProperties + :keyword storage_id: Required. The resource id of Azure Spring Apps Storage resource. + :paramtype storage_id: str + """ + super(CustomPersistentDiskResource, self).__init__(**kwargs) + self.custom_persistent_disk_properties = custom_persistent_disk_properties + self.storage_id = storage_id + + +class DeploymentInstance(msrest.serialization.Model): + """Deployment instance payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the deployment instance. + :vartype name: str + :ivar status: Status of the deployment instance. + :vartype status: str + :ivar reason: Failed reason of the deployment instance. + :vartype reason: str + :ivar discovery_status: Discovery status of the deployment instance. + :vartype discovery_status: str + :ivar start_time: Start time of the deployment instance. + :vartype start_time: str + :ivar zone: Availability zone information of the deployment instance. + :vartype zone: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + 'reason': {'readonly': True}, + 'discovery_status': {'readonly': True}, + 'start_time': {'readonly': True}, + 'zone': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'zone': {'key': 'zone', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeploymentInstance, self).__init__(**kwargs) + self.name = None + self.status = None + self.reason = None + self.discovery_status = None + self.start_time = None + self.zone = None + + +class DeploymentResource(ProxyResource): + """Deployment resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the Deployment resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProperties + :ivar sku: Sku of the Deployment resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + + _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': 'DeploymentResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + properties: Optional["DeploymentResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Deployment resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProperties + :keyword sku: Sku of the Deployment resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + super(DeploymentResource, self).__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class DeploymentResourceCollection(msrest.serialization.Model): + """Object that includes an array of App resources and a possible link for next set. + + :ivar value: Collection of Deployment resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeploymentResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeploymentResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Deployment resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(DeploymentResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeploymentResourceProperties(msrest.serialization.Model): + """Deployment resource properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar source: Uploaded source information of the deployment. + :vartype source: ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserSourceInfo + :ivar deployment_settings: Deployment settings of the Deployment. + :vartype deployment_settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentSettings + :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: + "Creating", "Updating", "Succeeded", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProvisioningState + :ivar status: Status of the Deployment. Possible values include: "Stopped", "Running". + :vartype status: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceStatus + :ivar active: Indicates whether the Deployment is active. + :vartype active: bool + :ivar instances: Collection of instances belong to the Deployment. + :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'status': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'source': {'key': 'source', 'type': 'UserSourceInfo'}, + 'deployment_settings': {'key': 'deploymentSettings', 'type': 'DeploymentSettings'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'active': {'key': 'active', 'type': 'bool'}, + 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, + } + + def __init__( + self, + *, + source: Optional["UserSourceInfo"] = None, + deployment_settings: Optional["DeploymentSettings"] = None, + active: Optional[bool] = None, + **kwargs + ): + """ + :keyword source: Uploaded source information of the deployment. + :paramtype source: ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserSourceInfo + :keyword deployment_settings: Deployment settings of the Deployment. + :paramtype deployment_settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentSettings + :keyword active: Indicates whether the Deployment is active. + :paramtype active: bool + """ + super(DeploymentResourceProperties, self).__init__(**kwargs) + self.source = source + self.deployment_settings = deployment_settings + self.provisioning_state = None + self.status = None + self.active = active + self.instances = None + + +class DeploymentSettings(msrest.serialization.Model): + """Deployment settings payload. + + :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :vartype resource_requests: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceRequests + :ivar environment_variables: Collection of environment variables. + :vartype environment_variables: dict[str, str] + :ivar addon_configs: Collection of addons. + :vartype addon_configs: dict[str, dict[str, any]] + :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted + if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype liveness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe + :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be + removed from service endpoints if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype readiness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe + :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. + If specified, no other probes are executed until this completes successfully. If this probe + fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to + provide different probe parameters at the beginning of a App Instance's lifecycle, when it + might take a long time to load data or warm a cache, than during steady-state operation. This + cannot be updated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype startup_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe + :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to + terminate gracefully. May be decreased in delete request. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If + this value is nil, the default grace period will be used instead. The grace period is the + duration in seconds after the processes running in the App Instance are sent a termination + signal and the time when the processes are forcibly halted with a kill signal. Set this value + longer than the expected cleanup time for your process. Defaults to 90 seconds. + :vartype termination_grace_period_seconds: int + :ivar container_probe_settings: Container liveness and readiness probe settings. + :vartype container_probe_settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ContainerProbeSettings + """ + + _attribute_map = { + 'resource_requests': {'key': 'resourceRequests', 'type': 'ResourceRequests'}, + 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, + 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, + 'liveness_probe': {'key': 'livenessProbe', 'type': 'Probe'}, + 'readiness_probe': {'key': 'readinessProbe', 'type': 'Probe'}, + 'startup_probe': {'key': 'startupProbe', 'type': 'Probe'}, + 'termination_grace_period_seconds': {'key': 'terminationGracePeriodSeconds', 'type': 'int'}, + 'container_probe_settings': {'key': 'containerProbeSettings', 'type': 'ContainerProbeSettings'}, + } + + def __init__( + self, + *, + resource_requests: Optional["ResourceRequests"] = None, + environment_variables: Optional[Dict[str, str]] = None, + addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, + liveness_probe: Optional["Probe"] = None, + readiness_probe: Optional["Probe"] = None, + startup_probe: Optional["Probe"] = None, + termination_grace_period_seconds: Optional[int] = 90, + container_probe_settings: Optional["ContainerProbeSettings"] = None, + **kwargs + ): + """ + :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is + recommended that using this field to represent the required CPU and Memory, the old field cpu + and memoryInGB will be deprecated later. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceRequests + :keyword environment_variables: Collection of environment variables. + :paramtype environment_variables: dict[str, str] + :keyword addon_configs: Collection of addons. + :paramtype addon_configs: dict[str, dict[str, any]] + :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be + restarted if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype liveness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe + :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will + be removed from service endpoints if the probe fails. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype readiness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe + :keyword startup_probe: StartupProbe indicates that the App Instance has successfully + initialized. If specified, no other probes are executed until this completes successfully. If + this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be + used to provide different probe parameters at the beginning of a App Instance's lifecycle, when + it might take a long time to load data or warm a cache, than during steady-state operation. + This cannot be updated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype startup_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe + :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs + to terminate gracefully. May be decreased in delete request. Value must be non-negative + integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut + down). If this value is nil, the default grace period will be used instead. The grace period is + the duration in seconds after the processes running in the App Instance are sent a termination + signal and the time when the processes are forcibly halted with a kill signal. Set this value + longer than the expected cleanup time for your process. Defaults to 90 seconds. + :paramtype termination_grace_period_seconds: int + :keyword container_probe_settings: Container liveness and readiness probe settings. + :paramtype container_probe_settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ContainerProbeSettings + """ + super(DeploymentSettings, self).__init__(**kwargs) + self.resource_requests = resource_requests + self.environment_variables = environment_variables + self.addon_configs = addon_configs + self.liveness_probe = liveness_probe + self.readiness_probe = readiness_probe + self.startup_probe = startup_probe + self.termination_grace_period_seconds = termination_grace_period_seconds + self.container_probe_settings = container_probe_settings + + +class DiagnosticParameters(msrest.serialization.Model): + """Diagnostic parameters of diagnostic operations. + + :ivar app_instance: App instance name. + :vartype app_instance: str + :ivar file_path: Your target file path in your own BYOS. + :vartype file_path: str + :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :vartype duration: str + """ + + _attribute_map = { + 'app_instance': {'key': 'appInstance', 'type': 'str'}, + 'file_path': {'key': 'filePath', 'type': 'str'}, + 'duration': {'key': 'duration', 'type': 'str'}, + } + + def __init__( + self, + *, + app_instance: Optional[str] = None, + file_path: Optional[str] = None, + duration: Optional[str] = None, + **kwargs + ): + """ + :keyword app_instance: App instance name. + :paramtype app_instance: str + :keyword file_path: Your target file path in your own BYOS. + :paramtype file_path: str + :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :paramtype duration: str + """ + super(DiagnosticParameters, self).__init__(**kwargs) + self.app_instance = app_instance + self.file_path = file_path + self.duration = duration + + +class Error(msrest.serialization.Model): + """The error code compose of code and message. + + :ivar code: The code of error. + :vartype code: str + :ivar message: The message of error. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: The code of error. + :paramtype code: str + :keyword message: The message of error. + :paramtype message: str + """ + super(Error, self).__init__(**kwargs) + self.code = code + self.message = message + + +class ProbeAction(msrest.serialization.Model): + """The action of the probe. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ExecAction, HTTPGetAction, TCPSocketAction. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the action to take to perform the health check.Constant + filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'ExecAction': 'ExecAction', 'HTTPGetAction': 'HTTPGetAction', 'TCPSocketAction': 'TCPSocketAction'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProbeAction, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class ExecAction(ProbeAction): + """ExecAction describes a "run in container" action. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the action to take to perform the health check.Constant + filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType + :ivar command: Command is the command line to execute inside the container, the working + directory for the command is root ('/') in the container's filesystem. The command is not run + inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you + need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and + non-zero is unhealthy. + :vartype command: list[str] + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'command': {'key': 'command', 'type': '[str]'}, + } + + def __init__( + self, + *, + command: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword command: Command is the command line to execute inside the container, the working + directory for the command is root ('/') in the container's filesystem. The command is not run + inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you + need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and + non-zero is unhealthy. + :paramtype command: list[str] + """ + super(ExecAction, self).__init__(**kwargs) + self.type = 'ExecAction' # type: str + self.command = command + + +class GatewayApiMetadataProperties(msrest.serialization.Model): + """API metadata property for Spring Cloud Gateway. + + :ivar title: Title describing the context of the APIs available on the Gateway instance + (default: ``Spring Cloud Gateway for K8S``\ ). + :vartype title: str + :ivar description: Detailed description of the APIs available on the Gateway instance (default: + ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :vartype description: str + :ivar documentation: Location of additional documentation for the APIs available on the Gateway + instance. + :vartype documentation: str + :ivar version: Version of APIs available on this Gateway instance (default: ``unspecified``\ ). + :vartype version: str + :ivar server_url: Base URL that API consumers will use to access APIs on the Gateway instance. + :vartype server_url: str + """ + + _attribute_map = { + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'documentation': {'key': 'documentation', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'server_url': {'key': 'serverUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + documentation: Optional[str] = None, + version: Optional[str] = None, + server_url: Optional[str] = None, + **kwargs + ): + """ + :keyword title: Title describing the context of the APIs available on the Gateway instance + (default: ``Spring Cloud Gateway for K8S``\ ). + :paramtype title: str + :keyword description: Detailed description of the APIs available on the Gateway instance + (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :paramtype description: str + :keyword documentation: Location of additional documentation for the APIs available on the + Gateway instance. + :paramtype documentation: str + :keyword version: Version of APIs available on this Gateway instance (default: ``unspecified``\ + ). + :paramtype version: str + :keyword server_url: Base URL that API consumers will use to access APIs on the Gateway + instance. + :paramtype server_url: str + """ + super(GatewayApiMetadataProperties, self).__init__(**kwargs) + self.title = title + self.description = description + self.documentation = documentation + self.version = version + self.server_url = server_url + + +class GatewayApiRoute(msrest.serialization.Model): + """API route config of the Spring Cloud Gateway. + + :ivar title: A title, will be applied to methods in the generated OpenAPI documentation. + :vartype title: str + :ivar description: A description, will be applied to methods in the generated OpenAPI + documentation. + :vartype description: str + :ivar uri: Full uri, will override ``appName``. + :vartype uri: str + :ivar sso_enabled: Enable sso validation. + :vartype sso_enabled: bool + :ivar token_relay: Pass currently-authenticated user's identity token to application service, + default is 'false'. + :vartype token_relay: bool + :ivar predicates: A number of conditions to evaluate a route for each request. Each predicate + may be evaluated against request headers and parameter values. All of the predicates associated + with a route must evaluate to true for the route to be matched to the request. + :vartype predicates: list[str] + :ivar filters: To modify the request before sending it to the target endpoint, or the received + response. + :vartype filters: list[str] + :ivar order: Route processing order. + :vartype order: int + :ivar tags: A set of tags. Classification tags, will be applied to methods in the generated + OpenAPI documentation. + :vartype tags: list[str] + """ + + _attribute_map = { + 'title': {'key': 'title', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'sso_enabled': {'key': 'ssoEnabled', 'type': 'bool'}, + 'token_relay': {'key': 'tokenRelay', 'type': 'bool'}, + 'predicates': {'key': 'predicates', 'type': '[str]'}, + 'filters': {'key': 'filters', 'type': '[str]'}, + 'order': {'key': 'order', 'type': 'int'}, + 'tags': {'key': 'tags', 'type': '[str]'}, + } + + def __init__( + self, + *, + title: Optional[str] = None, + description: Optional[str] = None, + uri: Optional[str] = None, + sso_enabled: Optional[bool] = None, + token_relay: Optional[bool] = None, + predicates: Optional[List[str]] = None, + filters: Optional[List[str]] = None, + order: Optional[int] = None, + tags: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword title: A title, will be applied to methods in the generated OpenAPI documentation. + :paramtype title: str + :keyword description: A description, will be applied to methods in the generated OpenAPI + documentation. + :paramtype description: str + :keyword uri: Full uri, will override ``appName``. + :paramtype uri: str + :keyword sso_enabled: Enable sso validation. + :paramtype sso_enabled: bool + :keyword token_relay: Pass currently-authenticated user's identity token to application + service, default is 'false'. + :paramtype token_relay: bool + :keyword predicates: A number of conditions to evaluate a route for each request. Each + predicate may be evaluated against request headers and parameter values. All of the predicates + associated with a route must evaluate to true for the route to be matched to the request. + :paramtype predicates: list[str] + :keyword filters: To modify the request before sending it to the target endpoint, or the + received response. + :paramtype filters: list[str] + :keyword order: Route processing order. + :paramtype order: int + :keyword tags: A set of tags. Classification tags, will be applied to methods in the generated + OpenAPI documentation. + :paramtype tags: list[str] + """ + super(GatewayApiRoute, self).__init__(**kwargs) + self.title = title + self.description = description + self.uri = uri + self.sso_enabled = sso_enabled + self.token_relay = token_relay + self.predicates = predicates + self.filters = filters + self.order = order + self.tags = tags + + +class GatewayCorsProperties(msrest.serialization.Model): + """Cross-Origin Resource Sharing property. + + :ivar allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :vartype allowed_origins: list[str] + :ivar allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. + :vartype allowed_methods: list[str] + :ivar allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows + actual requests to send any header. + :vartype allowed_headers: list[str] + :ivar max_age: How long, in seconds, the response from a pre-flight request can be cached by + clients. + :vartype max_age: int + :ivar allow_credentials: Whether user credentials are supported on cross-site requests. Valid + values: ``true``\ , ``false``. + :vartype allow_credentials: bool + :ivar exposed_headers: HTTP response headers to expose for cross-site requests. + :vartype exposed_headers: list[str] + """ + + _attribute_map = { + 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, + 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, + 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, + 'max_age': {'key': 'maxAge', 'type': 'int'}, + 'allow_credentials': {'key': 'allowCredentials', 'type': 'bool'}, + 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_origins: Optional[List[str]] = None, + allowed_methods: Optional[List[str]] = None, + allowed_headers: Optional[List[str]] = None, + max_age: Optional[int] = None, + allow_credentials: Optional[bool] = None, + exposed_headers: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + allows all domains. + :paramtype allowed_origins: list[str] + :keyword allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. + :paramtype allowed_methods: list[str] + :keyword allowed_headers: Allowed headers in cross-site requests. The special value ``*`` + allows actual requests to send any header. + :paramtype allowed_headers: list[str] + :keyword max_age: How long, in seconds, the response from a pre-flight request can be cached by + clients. + :paramtype max_age: int + :keyword allow_credentials: Whether user credentials are supported on cross-site requests. + Valid values: ``true``\ , ``false``. + :paramtype allow_credentials: bool + :keyword exposed_headers: HTTP response headers to expose for cross-site requests. + :paramtype exposed_headers: list[str] + """ + super(GatewayCorsProperties, self).__init__(**kwargs) + self.allowed_origins = allowed_origins + self.allowed_methods = allowed_methods + self.allowed_headers = allowed_headers + self.max_age = max_age + self.allow_credentials = allow_credentials + self.exposed_headers = exposed_headers + + +class GatewayCustomDomainProperties(msrest.serialization.Model): + """The properties of custom domain for Spring Cloud Gateway. + + :ivar thumbprint: The thumbprint of bound certificate. + :vartype thumbprint: str + """ + + _attribute_map = { + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + } + + def __init__( + self, + *, + thumbprint: Optional[str] = None, + **kwargs + ): + """ + :keyword thumbprint: The thumbprint of bound certificate. + :paramtype thumbprint: str + """ + super(GatewayCustomDomainProperties, self).__init__(**kwargs) + self.thumbprint = thumbprint + + +class GatewayCustomDomainResource(ProxyResource): + """Custom domain of the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: The properties of custom domain for Spring Cloud Gateway. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainProperties + """ + + _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': 'GatewayCustomDomainProperties'}, + } + + def __init__( + self, + *, + properties: Optional["GatewayCustomDomainProperties"] = None, + **kwargs + ): + """ + :keyword properties: The properties of custom domain for Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainProperties + """ + super(GatewayCustomDomainResource, self).__init__(**kwargs) + self.properties = properties + + +class GatewayCustomDomainResourceCollection(msrest.serialization.Model): + """Object that includes an array of Spring Cloud Gateway custom domain resources and a possible link for next set. + + :ivar value: Collection of Spring Cloud Gateway custom domain resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GatewayCustomDomainResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GatewayCustomDomainResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Spring Cloud Gateway custom domain resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(GatewayCustomDomainResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayInstance(msrest.serialization.Model): + """Collection of instances belong to the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Spring Cloud Gateway instance. + :vartype name: str + :ivar status: Status of the Spring Cloud Gateway instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GatewayInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class GatewayOperatorProperties(msrest.serialization.Model): + """Properties of the Spring Cloud Gateway Operator. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayOperatorResourceRequests + :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. + :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayInstance] + """ + + _validation = { + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'resource_requests': {'key': 'resourceRequests', 'type': 'GatewayOperatorResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[GatewayInstance]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GatewayOperatorProperties, self).__init__(**kwargs) + self.resource_requests = None + self.instances = None + + +class GatewayOperatorResourceRequests(msrest.serialization.Model): + """Properties of the Spring Cloud Gateway Operator. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Spring Cloud Gateway Operator instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Spring Cloud Gateway Operator instance. + :vartype memory: str + :ivar instance_count: Instance count of the Spring Cloud Gateway Operator. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(GatewayOperatorResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class GatewayProperties(msrest.serialization.Model): + """Spring Cloud Gateway properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Spring Cloud Gateway. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProvisioningState + :ivar public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :vartype public: bool + :ivar url: URL of the Spring Cloud Gateway, exposed when 'public' is true. + :vartype url: str + :ivar https_only: Indicate if only https is allowed. + :vartype https_only: bool + :ivar sso_properties: Single sign-on related configuration. + :vartype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties + :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. + :vartype api_metadata_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiMetadataProperties + :ivar cors_properties: Cross-Origin Resource Sharing property. + :vartype cors_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCorsProperties + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceRequests + :ivar instances: Collection of instances belong to Spring Cloud Gateway. + :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayInstance] + :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. + :vartype operator_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayOperatorProperties + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'url': {'readonly': True}, + 'instances': {'readonly': True}, + 'operator_properties': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'public': {'key': 'public', 'type': 'bool'}, + 'url': {'key': 'url', 'type': 'str'}, + 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, + 'sso_properties': {'key': 'ssoProperties', 'type': 'SsoProperties'}, + 'api_metadata_properties': {'key': 'apiMetadataProperties', 'type': 'GatewayApiMetadataProperties'}, + 'cors_properties': {'key': 'corsProperties', 'type': 'GatewayCorsProperties'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'GatewayResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[GatewayInstance]'}, + 'operator_properties': {'key': 'operatorProperties', 'type': 'GatewayOperatorProperties'}, + } + + def __init__( + self, + *, + public: Optional[bool] = False, + https_only: Optional[bool] = False, + sso_properties: Optional["SsoProperties"] = None, + api_metadata_properties: Optional["GatewayApiMetadataProperties"] = None, + cors_properties: Optional["GatewayCorsProperties"] = None, + resource_requests: Optional["GatewayResourceRequests"] = None, + **kwargs + ): + """ + :keyword public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :paramtype public: bool + :keyword https_only: Indicate if only https is allowed. + :paramtype https_only: bool + :keyword sso_properties: Single sign-on related configuration. + :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties + :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. + :paramtype api_metadata_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiMetadataProperties + :keyword cors_properties: Cross-Origin Resource Sharing property. + :paramtype cors_properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCorsProperties + :keyword resource_requests: The requested resource quantity for required CPU and Memory. + :paramtype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceRequests + """ + super(GatewayProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.public = public + self.url = None + self.https_only = https_only + self.sso_properties = sso_properties + self.api_metadata_properties = api_metadata_properties + self.cors_properties = cors_properties + self.resource_requests = resource_requests + self.instances = None + self.operator_properties = None + + +class GatewayResource(ProxyResource): + """Spring Cloud Gateway 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Spring Cloud Gateway properties payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProperties + :ivar sku: Sku of the Spring Cloud Gateway resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + + _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': 'GatewayProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + properties: Optional["GatewayProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword properties: Spring Cloud Gateway properties payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProperties + :keyword sku: Sku of the Spring Cloud Gateway resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + super(GatewayResource, self).__init__(**kwargs) + self.properties = properties + self.sku = sku + + +class GatewayResourceCollection(msrest.serialization.Model): + """Object that includes an array of gateway resources and a possible link for next set. + + :ivar value: Collection of gateway resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GatewayResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GatewayResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of gateway resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(GatewayResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GatewayResourceRequests(msrest.serialization.Model): + """Resource request payload of Spring Cloud Gateway. + + :ivar cpu: Cpu allocated to each Spring Cloud Gateway instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Spring Cloud Gateway instance. + :vartype memory: str + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + cpu: Optional[str] = None, + memory: Optional[str] = None, + **kwargs + ): + """ + :keyword cpu: Cpu allocated to each Spring Cloud Gateway instance. + :paramtype cpu: str + :keyword memory: Memory allocated to each Spring Cloud Gateway instance. + :paramtype memory: str + """ + super(GatewayResourceRequests, self).__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class GatewayRouteConfigOpenApiProperties(msrest.serialization.Model): + """OpenAPI properties of Spring Cloud Gateway route config. + + :ivar uri: The URI of OpenAPI specification. + :vartype uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: Optional[str] = None, + **kwargs + ): + """ + :keyword uri: The URI of OpenAPI specification. + :paramtype uri: str + """ + super(GatewayRouteConfigOpenApiProperties, self).__init__(**kwargs) + self.uri = uri + + +class GatewayRouteConfigProperties(msrest.serialization.Model): + """API route config of the Spring Cloud Gateway. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Spring Cloud Gateway route config. Possible values + include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProvisioningState + :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route + defines ``uri``. + :vartype app_resource_id: str + :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. + :vartype open_api: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigOpenApiProperties + :ivar routes: Array of API routes, each route contains properties such as ``title``\ , ``uri``\ + , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :vartype routes: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiRoute] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'app_resource_id': {'key': 'appResourceId', 'type': 'str'}, + 'open_api': {'key': 'openApi', 'type': 'GatewayRouteConfigOpenApiProperties'}, + 'routes': {'key': 'routes', 'type': '[GatewayApiRoute]'}, + } + + def __init__( + self, + *, + app_resource_id: Optional[str] = None, + open_api: Optional["GatewayRouteConfigOpenApiProperties"] = None, + routes: Optional[List["GatewayApiRoute"]] = None, + **kwargs + ): + """ + :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route + defines ``uri``. + :paramtype app_resource_id: str + :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. + :paramtype open_api: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigOpenApiProperties + :keyword routes: Array of API routes, each route contains properties such as ``title``\ , + ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :paramtype routes: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiRoute] + """ + super(GatewayRouteConfigProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.app_resource_id = app_resource_id + self.open_api = open_api + self.routes = routes + + +class GatewayRouteConfigResource(ProxyResource): + """Spring Cloud Gateway route config 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: API route config of the Spring Cloud Gateway. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigProperties + """ + + _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': 'GatewayRouteConfigProperties'}, + } + + def __init__( + self, + *, + properties: Optional["GatewayRouteConfigProperties"] = None, + **kwargs + ): + """ + :keyword properties: API route config of the Spring Cloud Gateway. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigProperties + """ + super(GatewayRouteConfigResource, self).__init__(**kwargs) + self.properties = properties + + +class GatewayRouteConfigResourceCollection(msrest.serialization.Model): + """Object that includes an array of Spring Cloud Gateway route config resources and a possible link for next set. + + :ivar value: Collection of Spring Cloud Gateway route config resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[GatewayRouteConfigResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["GatewayRouteConfigResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Spring Cloud Gateway route config resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(GatewayRouteConfigResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class GitPatternRepository(msrest.serialization.Model): + """Git repository property payload for config server. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Name of the repository. + :vartype name: str + :ivar pattern: Collection of pattern of the repository. + :vartype pattern: list[str] + :ivar uri: Required. URI of the repository. + :vartype uri: str + :ivar label: Label of the repository. + :vartype label: str + :ivar search_paths: Searching path of the repository. + :vartype search_paths: list[str] + :ivar username: Username of git repository basic auth. + :vartype username: str + :ivar password: Password of git repository basic auth. + :vartype password: str + :ivar host_key: Public sshKey of git repository. + :vartype host_key: str + :ivar host_key_algorithm: SshKey algorithm of git repository. + :vartype host_key_algorithm: str + :ivar private_key: Private sshKey algorithm of git repository. + :vartype private_key: str + :ivar strict_host_key_checking: Strict host key checking or not. + :vartype strict_host_key_checking: bool + """ + + _validation = { + 'name': {'required': True}, + 'uri': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'pattern': {'key': 'pattern', 'type': '[str]'}, + 'uri': {'key': 'uri', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'host_key': {'key': 'hostKey', 'type': 'str'}, + 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + uri: str, + pattern: Optional[List[str]] = None, + label: Optional[str] = None, + search_paths: Optional[List[str]] = None, + username: Optional[str] = None, + password: Optional[str] = None, + host_key: Optional[str] = None, + host_key_algorithm: Optional[str] = None, + private_key: Optional[str] = None, + strict_host_key_checking: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Required. Name of the repository. + :paramtype name: str + :keyword pattern: Collection of pattern of the repository. + :paramtype pattern: list[str] + :keyword uri: Required. URI of the repository. + :paramtype uri: str + :keyword label: Label of the repository. + :paramtype label: str + :keyword search_paths: Searching path of the repository. + :paramtype search_paths: list[str] + :keyword username: Username of git repository basic auth. + :paramtype username: str + :keyword password: Password of git repository basic auth. + :paramtype password: str + :keyword host_key: Public sshKey of git repository. + :paramtype host_key: str + :keyword host_key_algorithm: SshKey algorithm of git repository. + :paramtype host_key_algorithm: str + :keyword private_key: Private sshKey algorithm of git repository. + :paramtype private_key: str + :keyword strict_host_key_checking: Strict host key checking or not. + :paramtype strict_host_key_checking: bool + """ + super(GitPatternRepository, self).__init__(**kwargs) + self.name = name + self.pattern = pattern + self.uri = uri + self.label = label + self.search_paths = search_paths + self.username = username + self.password = password + self.host_key = host_key + self.host_key_algorithm = host_key_algorithm + self.private_key = private_key + self.strict_host_key_checking = strict_host_key_checking + + +class HTTPGetAction(ProbeAction): + """HTTPGetAction describes an action based on HTTP Get requests. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the action to take to perform the health check.Constant + filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType + :ivar path: Path to access on the HTTP server. + :vartype path: str + :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https://. Possible values include: "HTTP", + "HTTPS". + :vartype scheme: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.HTTPSchemeType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + 'scheme': {'key': 'scheme', 'type': 'str'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + scheme: Optional[Union[str, "HTTPSchemeType"]] = None, + **kwargs + ): + """ + :keyword path: Path to access on the HTTP server. + :paramtype path: str + :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. + + Possible enum values: + + + * ``"HTTP"`` means that the scheme used will be http:// + * ``"HTTPS"`` means that the scheme used will be https://. Possible values include: "HTTP", + "HTTPS". + :paramtype scheme: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.HTTPSchemeType + """ + super(HTTPGetAction, self).__init__(**kwargs) + self.type = 'HTTPGetAction' # type: str + self.path = path + self.scheme = scheme + + +class ImageRegistryCredential(msrest.serialization.Model): + """Credential of the image registry. + + :ivar username: The username of the image registry credential. + :vartype username: str + :ivar password: The password of the image registry credential. + :vartype password: str + """ + + _attribute_map = { + 'username': {'key': 'username', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + } + + def __init__( + self, + *, + username: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + """ + :keyword username: The username of the image registry credential. + :paramtype username: str + :keyword password: The password of the image registry credential. + :paramtype password: str + """ + super(ImageRegistryCredential, self).__init__(**kwargs) + self.username = username + self.password = password + + +class IngressConfig(msrest.serialization.Model): + """Ingress configuration payload for Azure Spring Apps resource. + + :ivar read_timeout_in_seconds: Ingress read time out in seconds. + :vartype read_timeout_in_seconds: int + """ + + _attribute_map = { + 'read_timeout_in_seconds': {'key': 'readTimeoutInSeconds', 'type': 'int'}, + } + + def __init__( + self, + *, + read_timeout_in_seconds: Optional[int] = None, + **kwargs + ): + """ + :keyword read_timeout_in_seconds: Ingress read time out in seconds. + :paramtype read_timeout_in_seconds: int + """ + super(IngressConfig, self).__init__(**kwargs) + self.read_timeout_in_seconds = read_timeout_in_seconds + + +class UploadedUserSourceInfo(UserSourceInfo): + """Source with uploaded location. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: JarUploadedUserSourceInfo, NetCoreZipUploadedUserSourceInfo, SourceUploadedUserSourceInfo. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'Jar': 'JarUploadedUserSourceInfo', 'NetCoreZip': 'NetCoreZipUploadedUserSourceInfo', 'Source': 'SourceUploadedUserSourceInfo'} + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + """ + super(UploadedUserSourceInfo, self).__init__(version=version, **kwargs) + self.type = 'UploadedUserSourceInfo' # type: str + self.relative_path = relative_path + + +class JarUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar runtime_version: Runtime version of the Jar file. + :vartype runtime_version: str + :ivar jvm_options: JVM parameter. + :vartype jvm_options: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + runtime_version: Optional[str] = None, + jvm_options: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword runtime_version: Runtime version of the Jar file. + :paramtype runtime_version: str + :keyword jvm_options: JVM parameter. + :paramtype jvm_options: str + """ + super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'Jar' # type: str + self.runtime_version = runtime_version + self.jvm_options = jvm_options + + +class KeyVaultCertificateProperties(CertificateProperties): + """Properties of certificate imported from key vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the certificate source.Constant filled by server. + :vartype type: str + :ivar thumbprint: The thumbprint of certificate. + :vartype thumbprint: str + :ivar issuer: The issuer of certificate. + :vartype issuer: str + :ivar issued_date: The issue date of certificate. + :vartype issued_date: str + :ivar expiration_date: The expiration date of certificate. + :vartype expiration_date: str + :ivar activate_date: The activate date of certificate. + :vartype activate_date: str + :ivar subject_name: The subject name of certificate. + :vartype subject_name: str + :ivar dns_names: The domain list of certificate. + :vartype dns_names: list[str] + :ivar provisioning_state: Provisioning state of the Certificate. Possible values include: + "Creating", "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState + :ivar vault_uri: Required. The vault uri of user key vault. + :vartype vault_uri: str + :ivar key_vault_cert_name: Required. The certificate name of key vault. + :vartype key_vault_cert_name: str + :ivar cert_version: The certificate version of key vault. + :vartype cert_version: str + :ivar exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :vartype exclude_private_key: bool + """ + + _validation = { + 'type': {'required': True}, + 'thumbprint': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issued_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'activate_date': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'dns_names': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'vault_uri': {'required': True}, + 'key_vault_cert_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issued_date': {'key': 'issuedDate', 'type': 'str'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, + 'activate_date': {'key': 'activateDate', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, + 'cert_version': {'key': 'certVersion', 'type': 'str'}, + 'exclude_private_key': {'key': 'excludePrivateKey', 'type': 'bool'}, + } + + def __init__( + self, + *, + vault_uri: str, + key_vault_cert_name: str, + cert_version: Optional[str] = None, + exclude_private_key: Optional[bool] = False, + **kwargs + ): + """ + :keyword vault_uri: Required. The vault uri of user key vault. + :paramtype vault_uri: str + :keyword key_vault_cert_name: Required. The certificate name of key vault. + :paramtype key_vault_cert_name: str + :keyword cert_version: The certificate version of key vault. + :paramtype cert_version: str + :keyword exclude_private_key: Optional. If set to true, it will not import private key from key + vault. + :paramtype exclude_private_key: bool + """ + super(KeyVaultCertificateProperties, self).__init__(**kwargs) + self.type = 'KeyVaultCertificate' # type: str + self.vault_uri = vault_uri + self.key_vault_cert_name = key_vault_cert_name + self.cert_version = cert_version + self.exclude_private_key = exclude_private_key + + +class LoadedCertificate(msrest.serialization.Model): + """Loaded certificate payload. + + All required parameters must be populated in order to send to Azure. + + :ivar resource_id: Required. Resource Id of loaded certificate. + :vartype resource_id: str + :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :vartype load_trust_store: bool + """ + + _validation = { + 'resource_id': {'required': True}, + } + + _attribute_map = { + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'load_trust_store': {'key': 'loadTrustStore', 'type': 'bool'}, + } + + def __init__( + self, + *, + resource_id: str, + load_trust_store: Optional[bool] = False, + **kwargs + ): + """ + :keyword resource_id: Required. Resource Id of loaded certificate. + :paramtype resource_id: str + :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust + store, only work for Java runtime. + :paramtype load_trust_store: bool + """ + super(LoadedCertificate, self).__init__(**kwargs) + self.resource_id = resource_id + self.load_trust_store = load_trust_store + + +class LogFileUrlResponse(msrest.serialization.Model): + """Log file URL payload. + + All required parameters must be populated in order to send to Azure. + + :ivar url: Required. URL of the log file. + :vartype url: str + """ + + _validation = { + 'url': {'required': True}, + } + + _attribute_map = { + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__( + self, + *, + url: str, + **kwargs + ): + """ + :keyword url: Required. URL of the log file. + :paramtype url: str + """ + super(LogFileUrlResponse, self).__init__(**kwargs) + self.url = url + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedIdentityProperties(msrest.serialization.Model): + """Managed identity properties retrieved from ARM request headers. + + :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityType + :ivar principal_id: Principal Id of system-assigned managed identity. + :vartype principal_id: str + :ivar tenant_id: Tenant Id of system-assigned managed identity. + :vartype tenant_id: str + :ivar user_assigned_identities: Properties of user-assigned managed identities. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserAssignedManagedIdentity] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedManagedIdentity}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + principal_id: Optional[str] = None, + tenant_id: Optional[str] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedManagedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityType + :keyword principal_id: Principal Id of system-assigned managed identity. + :paramtype principal_id: str + :keyword tenant_id: Tenant Id of system-assigned managed identity. + :paramtype tenant_id: str + :keyword user_assigned_identities: Properties of user-assigned managed identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserAssignedManagedIdentity] + """ + super(ManagedIdentityProperties, self).__init__(**kwargs) + self.type = type + self.principal_id = principal_id + self.tenant_id = tenant_id + self.user_assigned_identities = user_assigned_identities + + +class MarketplaceResource(msrest.serialization.Model): + """Purchasing 3rd Party product for one Azure Spring Apps instance. + + :ivar plan: The plan id of the 3rd Party Artifact that is being procured. + :vartype plan: str + :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. + :vartype publisher: str + :ivar product: The 3rd Party artifact that is being procured. + :vartype product: str + """ + + _attribute_map = { + 'plan': {'key': 'plan', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__( + self, + *, + plan: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + **kwargs + ): + """ + :keyword plan: The plan id of the 3rd Party Artifact that is being procured. + :paramtype plan: str + :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. + :paramtype publisher: str + :keyword product: The 3rd Party artifact that is being procured. + :paramtype product: str + """ + super(MarketplaceResource, self).__init__(**kwargs) + self.plan = plan + self.publisher = publisher + self.product = product + + +class MetricDimension(msrest.serialization.Model): + """Specifications of the Dimension of metrics. + + :ivar name: Name of the dimension. + :vartype name: str + :ivar display_name: Localized friendly display name of the dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :vartype to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Name of the dimension. + :paramtype name: str + :keyword display_name: Localized friendly display name of the dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + export scenario. + :paramtype to_be_exported_for_shoebox: bool + """ + super(MetricDimension, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class MetricSpecification(msrest.serialization.Model): + """Specifications of the Metrics for Azure Monitoring. + + :ivar name: Name of the metric. + :vartype name: str + :ivar display_name: Localized friendly display name of the metric. + :vartype display_name: str + :ivar display_description: Localized friendly description of the metric. + :vartype display_description: str + :ivar unit: Unit that makes sense for the metric. + :vartype unit: str + :ivar category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :vartype category: str + :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + Maximum, Total, Count. + :vartype aggregation_type: str + :ivar supported_aggregation_types: Supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: Supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :vartype fill_gap_with_zero: bool + :ivar dimensions: Dimensions of the metric. + :vartype dimensions: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricDimension] + :ivar source_mdm_namespace: Name of the MDM namespace. Optional. + :vartype source_mdm_namespace: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'category': {'key': 'category', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, + 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + category: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + fill_gap_with_zero: Optional[bool] = None, + dimensions: Optional[List["MetricDimension"]] = None, + source_mdm_namespace: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the metric. + :paramtype name: str + :keyword display_name: Localized friendly display name of the metric. + :paramtype display_name: str + :keyword display_description: Localized friendly description of the metric. + :paramtype display_description: str + :keyword unit: Unit that makes sense for the metric. + :paramtype unit: str + :keyword category: Name of the metric category that the metric belongs to. A metric can only + belong to a single category. + :paramtype category: str + :keyword aggregation_type: Only provide one value for this field. Valid values: Average, + Minimum, Maximum, Total, Count. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: Supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: Supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + duration where no metric is emitted/published. + :paramtype fill_gap_with_zero: bool + :keyword dimensions: Dimensions of the metric. + :paramtype dimensions: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricDimension] + :keyword source_mdm_namespace: Name of the MDM namespace. Optional. + :paramtype source_mdm_namespace: str + """ + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.category = category + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.fill_gap_with_zero = fill_gap_with_zero + self.dimensions = dimensions + self.source_mdm_namespace = source_mdm_namespace + + +class MonitoringSettingProperties(msrest.serialization.Model): + """Monitoring Setting properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Monitoring Setting. Possible values include: + "NotAvailable", "Failed", "Succeeded", "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingState + :ivar error: Error when apply Monitoring Setting changes. + :vartype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error + :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated + since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate + if monitoringSettings enabled or not. + :vartype trace_enabled: bool + :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or + whitespace include empty will disable monitoringSettings. + :vartype app_insights_instrumentation_key: str + :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :vartype app_insights_sampling_rate: float + :ivar app_insights_agent_versions: Indicates the versions of application insight agent. + :vartype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApplicationInsightsAgentVersions + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'app_insights_sampling_rate': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'trace_enabled': {'key': 'traceEnabled', 'type': 'bool'}, + 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, + 'app_insights_sampling_rate': {'key': 'appInsightsSamplingRate', 'type': 'float'}, + 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, + } + + def __init__( + self, + *, + error: Optional["Error"] = None, + trace_enabled: Optional[bool] = None, + app_insights_instrumentation_key: Optional[str] = None, + app_insights_sampling_rate: Optional[float] = None, + app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, + **kwargs + ): + """ + :keyword error: Error when apply Monitoring Setting changes. + :paramtype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error + :keyword trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :paramtype trace_enabled: bool + :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :paramtype app_insights_instrumentation_key: str + :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + should be in range [0.0, 100.0]. + :paramtype app_insights_sampling_rate: float + :keyword app_insights_agent_versions: Indicates the versions of application insight agent. + :paramtype app_insights_agent_versions: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApplicationInsightsAgentVersions + """ + super(MonitoringSettingProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.error = error + self.trace_enabled = trace_enabled + self.app_insights_instrumentation_key = app_insights_instrumentation_key + self.app_insights_sampling_rate = app_insights_sampling_rate + self.app_insights_agent_versions = app_insights_agent_versions + + +class MonitoringSettingResource(ProxyResource): + """Monitoring Setting 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the Monitoring Setting resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingProperties + """ + + _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': 'MonitoringSettingProperties'}, + } + + def __init__( + self, + *, + properties: Optional["MonitoringSettingProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the Monitoring Setting resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingProperties + """ + super(MonitoringSettingResource, self).__init__(**kwargs) + self.properties = properties + + +class NameAvailability(msrest.serialization.Model): + """Name availability result payload. + + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: Reason why the name is not available. + :vartype reason: str + :ivar message: Message why the name is not available. + :vartype message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword name_available: Indicates whether the name is available. + :paramtype name_available: bool + :keyword reason: Reason why the name is not available. + :paramtype reason: str + :keyword message: Message why the name is not available. + :paramtype message: str + """ + super(NameAvailability, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class NameAvailabilityParameters(msrest.serialization.Model): + """Name availability parameters payload. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the resource to check name availability. + :vartype type: str + :ivar name: Required. Name to be checked. + :vartype name: str + """ + + _validation = { + 'type': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: str, + name: str, + **kwargs + ): + """ + :keyword type: Required. Type of the resource to check name availability. + :paramtype type: str + :keyword name: Required. Name to be checked. + :paramtype name: str + """ + super(NameAvailabilityParameters, self).__init__(**kwargs) + self.type = type + self.name = name + + +class NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Jar binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. + :vartype net_core_main_entry_path: str + :ivar runtime_version: Runtime version of the .Net file. + :vartype runtime_version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + net_core_main_entry_path: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. + :paramtype net_core_main_entry_path: str + :keyword runtime_version: Runtime version of the .Net file. + :paramtype runtime_version: str + """ + super(NetCoreZipUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'NetCoreZip' # type: str + self.net_core_main_entry_path = net_core_main_entry_path + self.runtime_version = runtime_version + + +class NetworkProfile(msrest.serialization.Model): + """Service network profile payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring + Apps Service Runtime. + :vartype service_runtime_subnet_id: str + :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure + Spring Apps. + :vartype app_subnet_id: str + :ivar service_cidr: Azure Spring Apps service reserved CIDR. + :vartype service_cidr: str + :ivar service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :vartype service_runtime_network_resource_group: str + :ivar app_network_resource_group: Name of the resource group containing network resources for + customer apps in Azure Spring Apps. + :vartype app_network_resource_group: str + :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. + :vartype outbound_i_ps: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfileOutboundIPs + :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. + :vartype required_traffics: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.RequiredTraffic] + :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. + :vartype ingress_config: ~azure.mgmt.appplatform.v2022_05_01_preview.models.IngressConfig + """ + + _validation = { + 'outbound_i_ps': {'readonly': True}, + 'required_traffics': {'readonly': True}, + } + + _attribute_map = { + 'service_runtime_subnet_id': {'key': 'serviceRuntimeSubnetId', 'type': 'str'}, + 'app_subnet_id': {'key': 'appSubnetId', 'type': 'str'}, + 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, + 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, + 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, + 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, + 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, + 'ingress_config': {'key': 'ingressConfig', 'type': 'IngressConfig'}, + } + + def __init__( + self, + *, + service_runtime_subnet_id: Optional[str] = None, + app_subnet_id: Optional[str] = None, + service_cidr: Optional[str] = None, + service_runtime_network_resource_group: Optional[str] = None, + app_network_resource_group: Optional[str] = None, + ingress_config: Optional["IngressConfig"] = None, + **kwargs + ): + """ + :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Apps Service Runtime. + :paramtype service_runtime_subnet_id: str + :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in + Azure Spring Apps. + :paramtype app_subnet_id: str + :keyword service_cidr: Azure Spring Apps service reserved CIDR. + :paramtype service_cidr: str + :keyword service_runtime_network_resource_group: Name of the resource group containing network + resources of Azure Spring Apps Service Runtime. + :paramtype service_runtime_network_resource_group: str + :keyword app_network_resource_group: Name of the resource group containing network resources + for customer apps in Azure Spring Apps. + :paramtype app_network_resource_group: str + :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. + :paramtype ingress_config: ~azure.mgmt.appplatform.v2022_05_01_preview.models.IngressConfig + """ + super(NetworkProfile, self).__init__(**kwargs) + self.service_runtime_subnet_id = service_runtime_subnet_id + self.app_subnet_id = app_subnet_id + self.service_cidr = service_cidr + self.service_runtime_network_resource_group = service_runtime_network_resource_group + self.app_network_resource_group = app_network_resource_group + self.outbound_i_ps = None + self.required_traffics = None + self.ingress_config = ingress_config + + +class NetworkProfileOutboundIPs(msrest.serialization.Model): + """Desired outbound IP resources for Azure Spring Apps resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar public_i_ps: A list of public IP addresses. + :vartype public_i_ps: list[str] + """ + + _validation = { + 'public_i_ps': {'readonly': True}, + } + + _attribute_map = { + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NetworkProfileOutboundIPs, self).__init__(**kwargs) + self.public_i_ps = None + + +class OperationDetail(msrest.serialization.Model): + """Operation detail payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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.appplatform.v2022_05_01_preview.models.OperationDisplay + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. Possible values include: "Internal". + :vartype action_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActionType + :ivar origin: Origin of the operation. + :vartype origin: str + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationProperties + """ + + _validation = { + 'action_type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'action_type': {'key': 'actionType', 'type': 'str'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): + """ + :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.appplatform.v2022_05_01_preview.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationProperties + """ + super(OperationDetail, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.action_type = None + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :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 = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :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(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationProperties(msrest.serialization.Model): + """Extra Operation properties. + + :ivar service_specification: Service specifications of the operation. + :vartype service_specification: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + """ + :keyword service_specification: Service specifications of the operation. + :paramtype service_specification: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceSpecification + """ + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +class PersistentDisk(msrest.serialization.Model): + """Persistent disk payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size_in_gb: Size of the persistent disk in GB. + :vartype size_in_gb: int + :ivar used_in_gb: Size of the used persistent disk in GB. + :vartype used_in_gb: int + :ivar mount_path: Mount path of the persistent disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 50, 'minimum': 0}, + 'used_in_gb': {'readonly': True, 'maximum': 50, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'used_in_gb': {'key': 'usedInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = None, + **kwargs + ): + """ + :keyword size_in_gb: Size of the persistent disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the persistent disk. + :paramtype mount_path: str + """ + super(PersistentDisk, self).__init__(**kwargs) + self.size_in_gb = size_in_gb + self.used_in_gb = None + self.mount_path = mount_path + + +class Probe(msrest.serialization.Model): + """Probe describes a health check to be performed against an App Instance to determine whether it is alive or ready to receive traffic. + + All required parameters must be populated in order to send to Azure. + + :ivar probe_action: The action of the probe. + :vartype probe_action: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeAction + :ivar disable_probe: Required. Indicate whether the probe is disabled. + :vartype disable_probe: bool + :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes + are initiated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :vartype initial_delay_seconds: int + :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. + :vartype period_seconds: int + :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. + :vartype timeout_seconds: int + :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Minimum value is 1. + :vartype failure_threshold: int + :ivar success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + :vartype success_threshold: int + """ + + _validation = { + 'disable_probe': {'required': True}, + } + + _attribute_map = { + 'probe_action': {'key': 'probeAction', 'type': 'ProbeAction'}, + 'disable_probe': {'key': 'disableProbe', 'type': 'bool'}, + 'initial_delay_seconds': {'key': 'initialDelaySeconds', 'type': 'int'}, + 'period_seconds': {'key': 'periodSeconds', 'type': 'int'}, + 'timeout_seconds': {'key': 'timeoutSeconds', 'type': 'int'}, + 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, + 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, + } + + def __init__( + self, + *, + disable_probe: bool, + probe_action: Optional["ProbeAction"] = None, + initial_delay_seconds: Optional[int] = None, + period_seconds: Optional[int] = None, + timeout_seconds: Optional[int] = None, + failure_threshold: Optional[int] = None, + success_threshold: Optional[int] = None, + **kwargs + ): + """ + :keyword probe_action: The action of the probe. + :paramtype probe_action: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeAction + :keyword disable_probe: Required. Indicate whether the probe is disabled. + :paramtype disable_probe: bool + :keyword initial_delay_seconds: Number of seconds after the App Instance has started before + probes are initiated. More info: + https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. + :paramtype initial_delay_seconds: int + :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. + :paramtype period_seconds: int + :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is + 1. + :paramtype timeout_seconds: int + :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Minimum value is 1. + :paramtype failure_threshold: int + :keyword success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. + :paramtype success_threshold: int + """ + super(Probe, self).__init__(**kwargs) + self.probe_action = probe_action + self.disable_probe = disable_probe + self.initial_delay_seconds = initial_delay_seconds + self.period_seconds = period_seconds + self.timeout_seconds = timeout_seconds + self.failure_threshold = failure_threshold + self.success_threshold = success_threshold + + +class RegenerateTestKeyRequestPayload(msrest.serialization.Model): + """Regenerate test key request payload. + + All required parameters must be populated in order to send to Azure. + + :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :vartype key_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeyType + """ + + _validation = { + 'key_type': {'required': True}, + } + + _attribute_map = { + 'key_type': {'key': 'keyType', 'type': 'str'}, + } + + def __init__( + self, + *, + key_type: Union[str, "TestKeyType"], + **kwargs + ): + """ + :keyword key_type: Required. Type of the test key. Possible values include: "Primary", + "Secondary". + :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeyType + """ + super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) + self.key_type = key_type + + +class RequiredTraffic(msrest.serialization.Model): + """Required inbound or outbound traffic for Azure Spring Apps resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar protocol: The protocol of required traffic. + :vartype protocol: str + :ivar port: The port of required traffic. + :vartype port: int + :ivar ips: The ip list of required traffic. + :vartype ips: list[str] + :ivar fqdns: The FQDN list of required traffic. + :vartype fqdns: list[str] + :ivar direction: The direction of required traffic. Possible values include: "Inbound", + "Outbound". + :vartype direction: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TrafficDirection + """ + + _validation = { + 'protocol': {'readonly': True}, + 'port': {'readonly': True}, + 'ips': {'readonly': True}, + 'fqdns': {'readonly': True}, + 'direction': {'readonly': True}, + } + + _attribute_map = { + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'ips': {'key': 'ips', 'type': '[str]'}, + 'fqdns': {'key': 'fqdns', 'type': '[str]'}, + 'direction': {'key': 'direction', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(RequiredTraffic, self).__init__(**kwargs) + self.protocol = None + self.port = None + self.ips = None + self.fqdns = None + self.direction = None + + +class ResourceRequests(msrest.serialization.Model): + """Deployment resource request payload. + + :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :vartype cpu: str + :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, + 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :vartype memory: str + """ + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + } + + def __init__( + self, + *, + cpu: Optional[str] = None, + memory: Optional[str] = None, + **kwargs + ): + """ + :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 + for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. + :paramtype cpu: str + :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :paramtype memory: str + """ + super(ResourceRequests, self).__init__(**kwargs) + self.cpu = cpu + self.memory = memory + + +class ResourceSku(msrest.serialization.Model): + """Describes an available Azure Spring Apps SKU. + + :ivar resource_type: Gets the type of resource the SKU applies to. + :vartype resource_type: str + :ivar name: Gets the name of SKU. + :vartype name: str + :ivar tier: Gets the tier of SKU. + :vartype tier: str + :ivar capacity: Gets the capacity of SKU. + :vartype capacity: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuCapacity + :ivar locations: Gets the set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Gets a list of locations and availability zones in those locations where + the SKU is available. + :vartype location_info: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuLocationInfo] + :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :vartype restrictions: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictions] + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, + 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional["SkuCapacity"] = None, + locations: Optional[List[str]] = None, + location_info: Optional[List["ResourceSkuLocationInfo"]] = None, + restrictions: Optional[List["ResourceSkuRestrictions"]] = None, + **kwargs + ): + """ + :keyword resource_type: Gets the type of resource the SKU applies to. + :paramtype resource_type: str + :keyword name: Gets the name of SKU. + :paramtype name: str + :keyword tier: Gets the tier of SKU. + :paramtype tier: str + :keyword capacity: Gets the capacity of SKU. + :paramtype capacity: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuCapacity + :keyword locations: Gets the set of locations that the SKU is available. + :paramtype locations: list[str] + :keyword location_info: Gets a list of locations and availability zones in those locations + where the SKU is available. + :paramtype location_info: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuLocationInfo] + :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is + empty if there are no restrictions. + :paramtype restrictions: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictions] + """ + super(ResourceSku, self).__init__(**kwargs) + self.resource_type = resource_type + self.name = name + self.tier = tier + self.capacity = capacity + self.locations = locations + self.location_info = location_info + self.restrictions = restrictions + + +class ResourceSkuCapabilities(msrest.serialization.Model): + """ResourceSkuCapabilities. + + :ivar name: Gets an invariant to describe the feature. + :vartype name: str + :ivar value: Gets an invariant if the feature is measured by quantity. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Gets an invariant to describe the feature. + :paramtype name: str + :keyword value: Gets an invariant if the feature is measured by quantity. + :paramtype value: str + """ + super(ResourceSkuCapabilities, self).__init__(**kwargs) + self.name = name + self.value = value + + +class ResourceSkuCollection(msrest.serialization.Model): + """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. + + :ivar value: Collection of resource SKU. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSku] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceSku"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of resource SKU. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSku] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ResourceSkuCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ResourceSkuLocationInfo(msrest.serialization.Model): + """Locations and availability zones where the SKU is available. + + :ivar location: Gets location of the SKU. + :vartype location: str + :ivar zones: Gets list of availability zones where the SKU is supported. + :vartype zones: list[str] + :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. + :vartype zone_details: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuZoneDetails] + """ + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + zones: Optional[List[str]] = None, + zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, + **kwargs + ): + """ + :keyword location: Gets location of the SKU. + :paramtype location: str + :keyword zones: Gets list of availability zones where the SKU is supported. + :paramtype zones: list[str] + :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. + :paramtype zone_details: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuZoneDetails] + """ + super(ResourceSkuLocationInfo, self).__init__(**kwargs) + self.location = location + self.zones = zones + self.zone_details = zone_details + + +class ResourceSkuRestrictionInfo(msrest.serialization.Model): + """Information about the restriction where the SKU cannot be used. + + :ivar locations: Gets locations where the SKU is restricted. + :vartype locations: list[str] + :ivar zones: Gets list of availability zones where the SKU is restricted. + :vartype zones: list[str] + """ + + _attribute_map = { + 'locations': {'key': 'locations', 'type': '[str]'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + *, + locations: Optional[List[str]] = None, + zones: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword locations: Gets locations where the SKU is restricted. + :paramtype locations: list[str] + :keyword zones: Gets list of availability zones where the SKU is restricted. + :paramtype zones: list[str] + """ + super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) + self.locations = locations + self.zones = zones + + +class ResourceSkuRestrictions(msrest.serialization.Model): + """Restrictions where the SKU cannot be used. + + :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :vartype type: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsType + :ivar values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :vartype values: list[str] + :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :vartype restriction_info: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionInfo + :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :vartype reason_code: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, + 'reason_code': {'key': 'reasonCode', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, + values: Optional[List[str]] = None, + restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, + reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, + **kwargs + ): + """ + :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + Possible values include: "Location", "Zone". + :paramtype type: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsType + :keyword values: Gets the value of restrictions. If the restriction type is set to + location. This would be different locations where the SKU is restricted. + :paramtype values: list[str] + :keyword restriction_info: Gets the information about the restriction where the SKU cannot be + used. + :paramtype restriction_info: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionInfo + :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + 'NotAvailableForSubscription'. Possible values include: "QuotaId", + "NotAvailableForSubscription". + :paramtype reason_code: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsReasonCode + """ + super(ResourceSkuRestrictions, self).__init__(**kwargs) + self.type = type + self.values = values + self.restriction_info = restriction_info + self.reason_code = reason_code + + +class ResourceSkuZoneDetails(msrest.serialization.Model): + """Details of capabilities available to a SKU in specific zones. + + :ivar name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :vartype name: list[str] + :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :vartype capabilities: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCapabilities] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': '[str]'}, + 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, + } + + def __init__( + self, + *, + name: Optional[List[str]] = None, + capabilities: Optional[List["ResourceSkuCapabilities"]] = None, + **kwargs + ): + """ + :keyword name: Gets the set of zones that the SKU is available in with the + specified capabilities. + :paramtype name: list[str] + :keyword capabilities: Gets a list of capabilities that are available for the SKU in the + specified list of zones. + :paramtype capabilities: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCapabilities] + """ + super(ResourceSkuZoneDetails, self).__init__(**kwargs) + self.name = name + self.capabilities = capabilities + + +class ResourceUploadDefinition(msrest.serialization.Model): + """Resource upload definition payload. + + :ivar relative_path: Source relative path. + :vartype relative_path: str + :ivar upload_url: Upload URL. + :vartype upload_url: str + """ + + _attribute_map = { + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + relative_path: Optional[str] = None, + upload_url: Optional[str] = None, + **kwargs + ): + """ + :keyword relative_path: Source relative path. + :paramtype relative_path: str + :keyword upload_url: Upload URL. + :paramtype upload_url: str + """ + super(ResourceUploadDefinition, self).__init__(**kwargs) + self.relative_path = relative_path + self.upload_url = upload_url + + +class ServiceRegistryInstance(msrest.serialization.Model): + """Collection of instances belong to the Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Name of the Service Registry instance. + :vartype name: str + :ivar status: Status of the Service Registry instance. + :vartype status: str + """ + + _validation = { + 'name': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryInstance, self).__init__(**kwargs) + self.name = None + self.status = None + + +class ServiceRegistryProperties(msrest.serialization.Model): + """Service Registry properties payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: State of the Service Registry. Possible values include: "Creating", + "Updating", "Succeeded", "Failed", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProvisioningState + :ivar resource_requests: The requested resource quantity for required CPU and Memory. + :vartype resource_requests: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResourceRequests + :ivar instances: Collection of instances belong to Service Registry. + :vartype instances: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryInstance] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'resource_requests': {'readonly': True}, + 'instances': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'resource_requests': {'key': 'resourceRequests', 'type': 'ServiceRegistryResourceRequests'}, + 'instances': {'key': 'instances', 'type': '[ServiceRegistryInstance]'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.resource_requests = None + self.instances = None + + +class ServiceRegistryResource(ProxyResource): + """Service Registry 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Service Registry properties payload. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProperties + """ + + _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': 'ServiceRegistryProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ServiceRegistryProperties"] = None, + **kwargs + ): + """ + :keyword properties: Service Registry properties payload. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProperties + """ + super(ServiceRegistryResource, self).__init__(**kwargs) + self.properties = properties + + +class ServiceRegistryResourceCollection(msrest.serialization.Model): + """Object that includes an array of Service Registry resources and a possible link for next set. + + :ivar value: Collection of Service Registry resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceRegistryResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceRegistryResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Service Registry resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ServiceRegistryResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceRegistryResourceRequests(msrest.serialization.Model): + """Resource request payload of Service Registry. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Cpu allocated to each Service Registry instance. + :vartype cpu: str + :ivar memory: Memory allocated to each Service Registry instance. + :vartype memory: str + :ivar instance_count: Instance count of the Service Registry. + :vartype instance_count: int + """ + + _validation = { + 'cpu': {'readonly': True}, + 'memory': {'readonly': True}, + 'instance_count': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'str'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ServiceRegistryResourceRequests, self).__init__(**kwargs) + self.cpu = None + self.memory = None + self.instance_count = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + """ + super(TrackedResource, self).__init__(**kwargs) + self.location = location + self.tags = tags + + +class ServiceResource(TrackedResource): + """Service 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. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar location: The GEO location of the resource. + :vartype location: str + :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe + the resource. + :vartype tags: dict[str, str] + :ivar properties: Properties of the Service resource. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ClusterResourceProperties + :ivar sku: Sku of the Service resource. + :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + + _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'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ClusterResourceProperties"] = None, + sku: Optional["Sku"] = None, + **kwargs + ): + """ + :keyword location: The GEO location of the resource. + :paramtype location: str + :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the Service resource. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ClusterResourceProperties + :keyword sku: Sku of the Service resource. + :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku + """ + super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) + self.properties = properties + self.sku = sku + + +class ServiceResourceList(msrest.serialization.Model): + """Object that includes an array of Service resources and a possible link for next set. + + :ivar value: Collection of Service resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of Service resources. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): + """Service specification payload. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LogSpecification] + :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. + :vartype metric_specifications: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LogSpecification] + :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. + :paramtype metric_specifications: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricSpecification] + """ + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class ServiceVNetAddons(msrest.serialization.Model): + """Additional Service settings in vnet injection instance. + + :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance + could be accessed from internet. + :vartype log_stream_public_endpoint: bool + """ + + _attribute_map = { + 'log_stream_public_endpoint': {'key': 'logStreamPublicEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + log_stream_public_endpoint: Optional[bool] = False, + **kwargs + ): + """ + :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection + instance could be accessed from internet. + :paramtype log_stream_public_endpoint: bool + """ + super(ServiceVNetAddons, self).__init__(**kwargs) + self.log_stream_public_endpoint = log_stream_public_endpoint + + +class Sku(msrest.serialization.Model): + """Sku of Azure Spring Apps. + + :ivar name: Name of the Sku. + :vartype name: str + :ivar tier: Tier of the Sku. + :vartype tier: str + :ivar capacity: Current capacity of the target resource. + :vartype capacity: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = "S0", + tier: Optional[str] = "Standard", + capacity: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Name of the Sku. + :paramtype name: str + :keyword tier: Tier of the Sku. + :paramtype tier: str + :keyword capacity: Current capacity of the target resource. + :paramtype capacity: int + """ + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SkuCapacity(msrest.serialization.Model): + """The SKU capacity. + + All required parameters must be populated in order to send to Azure. + + :ivar minimum: Required. Gets or sets the minimum. + :vartype minimum: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar default: Gets or sets the default. + :vartype default: int + :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuScaleType + """ + + _validation = { + 'minimum': {'required': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + *, + minimum: int, + maximum: Optional[int] = None, + default: Optional[int] = None, + scale_type: Optional[Union[str, "SkuScaleType"]] = None, + **kwargs + ): + """ + :keyword minimum: Required. Gets or sets the minimum. + :paramtype minimum: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword default: Gets or sets the default. + :paramtype default: int + :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", + "Manual", "Automatic". + :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuScaleType + """ + super(SkuCapacity, self).__init__(**kwargs) + self.minimum = minimum + self.maximum = maximum + self.default = default + self.scale_type = scale_type + + +class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): + """Uploaded Java source code binary for a deployment. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. Type of the source uploaded.Constant filled by server. + :vartype type: str + :ivar version: Version of the source. + :vartype version: str + :ivar relative_path: Relative path of the storage which stores the source. + :vartype relative_path: str + :ivar artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :vartype artifact_selector: str + :ivar runtime_version: Runtime version of the source file. + :vartype runtime_version: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'relative_path': {'key': 'relativePath', 'type': 'str'}, + 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + version: Optional[str] = None, + relative_path: Optional[str] = None, + artifact_selector: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword version: Version of the source. + :paramtype version: str + :keyword relative_path: Relative path of the storage which stores the source. + :paramtype relative_path: str + :keyword artifact_selector: Selector for the artifact to be used for the deployment for + multi-module projects. This should be + the relative path to the target module/project. + :paramtype artifact_selector: str + :keyword runtime_version: Runtime version of the source file. + :paramtype runtime_version: str + """ + super(SourceUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + self.type = 'Source' # type: str + self.artifact_selector = artifact_selector + self.runtime_version = runtime_version + + +class SsoProperties(msrest.serialization.Model): + """Single sign-on related configuration. + + :ivar scope: It defines the specific actions applications can be allowed to do on a user's + behalf. + :vartype scope: list[str] + :ivar client_id: The public identifier for the application. + :vartype client_id: str + :ivar client_secret: The secret known only to the application and the authorization server. + :vartype client_secret: str + :ivar issuer_uri: The URI of Issuer Identifier. + :vartype issuer_uri: str + """ + + _attribute_map = { + 'scope': {'key': 'scope', 'type': '[str]'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret': {'key': 'clientSecret', 'type': 'str'}, + 'issuer_uri': {'key': 'issuerUri', 'type': 'str'}, + } + + def __init__( + self, + *, + scope: Optional[List[str]] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + issuer_uri: Optional[str] = None, + **kwargs + ): + """ + :keyword scope: It defines the specific actions applications can be allowed to do on a user's + behalf. + :paramtype scope: list[str] + :keyword client_id: The public identifier for the application. + :paramtype client_id: str + :keyword client_secret: The secret known only to the application and the authorization server. + :paramtype client_secret: str + :keyword issuer_uri: The URI of Issuer Identifier. + :paramtype issuer_uri: str + """ + super(SsoProperties, self).__init__(**kwargs) + self.scope = scope + self.client_id = client_id + self.client_secret = client_secret + self.issuer_uri = issuer_uri + + +class StackProperties(msrest.serialization.Model): + """KPack ClusterStack properties payload. + + :ivar id: Id of the ClusterStack. + :vartype id: str + :ivar version: Version of the ClusterStack. + :vartype version: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Id of the ClusterStack. + :paramtype id: str + :keyword version: Version of the ClusterStack. + :paramtype version: str + """ + super(StackProperties, self).__init__(**kwargs) + self.id = id + self.version = version + + +class StorageProperties(msrest.serialization.Model): + """Storage resource payload. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: StorageAccount. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageType + """ + + _validation = { + 'storage_type': {'required': True}, + } + + _attribute_map = { + 'storage_type': {'key': 'storageType', 'type': 'str'}, + } + + _subtype_map = { + 'storage_type': {'StorageAccount': 'StorageAccount'} + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(StorageProperties, self).__init__(**kwargs) + self.storage_type = None # type: Optional[str] + + +class StorageAccount(StorageProperties): + """storage resource of type Azure Storage Account. + + All required parameters must be populated in order to send to Azure. + + :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible + values include: "StorageAccount". + :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageType + :ivar account_name: Required. The account name of the Azure Storage Account. + :vartype account_name: str + :ivar account_key: Required. The account key of the Azure Storage Account. + :vartype account_key: str + """ + + _validation = { + 'storage_type': {'required': True}, + 'account_name': {'required': True}, + 'account_key': {'required': True}, + } + + _attribute_map = { + 'storage_type': {'key': 'storageType', 'type': 'str'}, + 'account_name': {'key': 'accountName', 'type': 'str'}, + 'account_key': {'key': 'accountKey', 'type': 'str'}, + } + + def __init__( + self, + *, + account_name: str, + account_key: str, + **kwargs + ): + """ + :keyword account_name: Required. The account name of the Azure Storage Account. + :paramtype account_name: str + :keyword account_key: Required. The account key of the Azure Storage Account. + :paramtype account_key: str + """ + super(StorageAccount, self).__init__(**kwargs) + self.storage_type = 'StorageAccount' # type: str + self.account_name = account_name + self.account_key = account_key + + +class StorageResource(ProxyResource): + """Storage resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Properties of the storage resource payload. + :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageProperties + """ + + _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': 'StorageProperties'}, + } + + def __init__( + self, + *, + properties: Optional["StorageProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the storage resource payload. + :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageProperties + """ + super(StorageResource, self).__init__(**kwargs) + self.properties = properties + + +class StorageResourceCollection(msrest.serialization.Model): + """Collection compose of storage resources list and a possible link for next page. + + :ivar value: The storage resources list. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] + :ivar next_link: The link to next page of storage list. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["StorageResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The storage resources list. + :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] + :keyword next_link: The link to next page of storage list. + :paramtype next_link: str + """ + super(StorageResourceCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedBuildpackResource(ProxyResource): + """Supported buildpack resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Supported buildpack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResourceProperties + """ + + _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': 'SupportedBuildpackResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["SupportedBuildpackResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Supported buildpack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResourceProperties + """ + super(SupportedBuildpackResource, self).__init__(**kwargs) + self.properties = properties + + +class SupportedBuildpackResourceProperties(msrest.serialization.Model): + """Supported buildpack resource properties. + + :ivar buildpack_id: The id of supported buildpack. + :vartype buildpack_id: str + """ + + _attribute_map = { + 'buildpack_id': {'key': 'buildpackId', 'type': 'str'}, + } + + def __init__( + self, + *, + buildpack_id: Optional[str] = None, + **kwargs + ): + """ + :keyword buildpack_id: The id of supported buildpack. + :paramtype buildpack_id: str + """ + super(SupportedBuildpackResourceProperties, self).__init__(**kwargs) + self.buildpack_id = buildpack_id + + +class SupportedBuildpacksCollection(msrest.serialization.Model): + """Object that includes an array of supported buildpacks resources and a possible link for next set. + + :ivar value: Collection of supported buildpacks resources. + :vartype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedBuildpackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SupportedBuildpackResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of supported buildpacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(SupportedBuildpacksCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SupportedRuntimeVersion(msrest.serialization.Model): + """Supported deployment runtime version descriptor. + + :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values + include: "Java_8", "Java_11", "Java_17", "NetCore_31". + :vartype value: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeValue + :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :vartype platform: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimePlatform + :ivar version: The detailed version (major.minor) of the platform. + :vartype version: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'platform': {'key': 'platform', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[Union[str, "SupportedRuntimeValue"]] = None, + platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "Java_17", "NetCore_31". + :paramtype value: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeValue + :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). + Possible values include: "Java", ".NET Core". + :paramtype platform: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimePlatform + :keyword version: The detailed version (major.minor) of the platform. + :paramtype version: str + """ + super(SupportedRuntimeVersion, self).__init__(**kwargs) + self.value = value + self.platform = platform + self.version = version + + +class SupportedStackResource(ProxyResource): + """Supported stack resource payload. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData + :ivar properties: Supported stack resource properties. + :vartype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResourceProperties + """ + + _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': 'SupportedStackResourceProperties'}, + } + + def __init__( + self, + *, + properties: Optional["SupportedStackResourceProperties"] = None, + **kwargs + ): + """ + :keyword properties: Supported stack resource properties. + :paramtype properties: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResourceProperties + """ + super(SupportedStackResource, self).__init__(**kwargs) + self.properties = properties + + +class SupportedStackResourceProperties(msrest.serialization.Model): + """Supported stack resource properties. + + :ivar stack_id: The id of supported stack. + :vartype stack_id: str + :ivar version: The version of supported stack. + :vartype version: str + """ + + _attribute_map = { + 'stack_id': {'key': 'stackId', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + stack_id: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + """ + :keyword stack_id: The id of supported stack. + :paramtype stack_id: str + :keyword version: The version of supported stack. + :paramtype version: str + """ + super(SupportedStackResourceProperties, self).__init__(**kwargs) + self.stack_id = stack_id + self.version = version + + +class SupportedStacksCollection(msrest.serialization.Model): + """Object that includes an array of supported stacks resources and a possible link for next set. + + :ivar value: Collection of supported stacks resources. + :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SupportedStackResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SupportedStackResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of supported stacks resources. + :paramtype value: + list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(SupportedStacksCollection, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.LastModifiedByType + :ivar last_modified_at: The timestamp of resource modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "LastModifiedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.appplatform.v2022_05_01_preview.models.LastModifiedByType + :keyword last_modified_at: The timestamp of resource modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TCPSocketAction(ProbeAction): + """TCPSocketAction describes an action based on opening a socket. + + All required parameters must be populated in order to send to Azure. + + :ivar type: Required. The type of the action to take to perform the health check.Constant + filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". + :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(TCPSocketAction, self).__init__(**kwargs) + self.type = 'TCPSocketAction' # type: str + + +class TemporaryDisk(msrest.serialization.Model): + """Temporary disk payload. + + :ivar size_in_gb: Size of the temporary disk in GB. + :vartype size_in_gb: int + :ivar mount_path: Mount path of the temporary disk. + :vartype mount_path: str + """ + + _validation = { + 'size_in_gb': {'maximum': 5, 'minimum': 0}, + } + + _attribute_map = { + 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + *, + size_in_gb: Optional[int] = None, + mount_path: Optional[str] = "/tmp", + **kwargs + ): + """ + :keyword size_in_gb: Size of the temporary disk in GB. + :paramtype size_in_gb: int + :keyword mount_path: Mount path of the temporary disk. + :paramtype mount_path: str + """ + super(TemporaryDisk, self).__init__(**kwargs) + self.size_in_gb = size_in_gb + self.mount_path = mount_path + + +class TestKeys(msrest.serialization.Model): + """Test keys payload. + + :ivar primary_key: Primary key. + :vartype primary_key: str + :ivar secondary_key: Secondary key. + :vartype secondary_key: str + :ivar primary_test_endpoint: Primary test endpoint. + :vartype primary_test_endpoint: str + :ivar secondary_test_endpoint: Secondary test endpoint. + :vartype secondary_test_endpoint: str + :ivar enabled: Indicates whether the test endpoint feature enabled or not. + :vartype enabled: bool + """ + + _attribute_map = { + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, + 'primary_test_endpoint': {'key': 'primaryTestEndpoint', 'type': 'str'}, + 'secondary_test_endpoint': {'key': 'secondaryTestEndpoint', 'type': 'str'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + primary_key: Optional[str] = None, + secondary_key: Optional[str] = None, + primary_test_endpoint: Optional[str] = None, + secondary_test_endpoint: Optional[str] = None, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword primary_key: Primary key. + :paramtype primary_key: str + :keyword secondary_key: Secondary key. + :paramtype secondary_key: str + :keyword primary_test_endpoint: Primary test endpoint. + :paramtype primary_test_endpoint: str + :keyword secondary_test_endpoint: Secondary test endpoint. + :paramtype secondary_test_endpoint: str + :keyword enabled: Indicates whether the test endpoint feature enabled or not. + :paramtype enabled: bool + """ + super(TestKeys, self).__init__(**kwargs) + self.primary_key = primary_key + self.secondary_key = secondary_key + self.primary_test_endpoint = primary_test_endpoint + self.secondary_test_endpoint = secondary_test_endpoint + self.enabled = enabled + + +class TriggeredBuildResult(msrest.serialization.Model): + """The build result triggered by a build. + + :ivar id: The unique build id of this build result. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: The unique build id of this build result. + :paramtype id: str + """ + super(TriggeredBuildResult, self).__init__(**kwargs) + self.id = id + + +class UserAssignedManagedIdentity(msrest.serialization.Model): + """The details of the user-assigned managed identity assigned to an App. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Principal Id of user-assigned managed identity. + :vartype principal_id: str + :ivar client_id: Client Id of user-assigned managed identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedManagedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class ValidationMessages(msrest.serialization.Model): + """Validate messages of the configuration service git repositories. + + :ivar name: The name of the configuration service git repository. + :vartype name: str + :ivar messages: Detailed validation messages. + :vartype messages: list[str] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'messages': {'key': 'messages', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + messages: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword name: The name of the configuration service git repository. + :paramtype name: str + :keyword messages: Detailed validation messages. + :paramtype messages: list[str] + """ + super(ValidationMessages, self).__init__(**kwargs) + self.name = name + self.messages = messages diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.py new file mode 100644 index 00000000000..0da100b4246 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.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 ._services_operations import ServicesOperations +from ._config_servers_operations import ConfigServersOperations +from ._configuration_services_operations import ConfigurationServicesOperations +from ._service_registries_operations import ServiceRegistriesOperations +from ._build_service_operations import BuildServiceOperations +from ._buildpack_binding_operations import BuildpackBindingOperations +from ._build_service_builder_operations import BuildServiceBuilderOperations +from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations +from ._monitoring_settings_operations import MonitoringSettingsOperations +from ._apps_operations import AppsOperations +from ._bindings_operations import BindingsOperations +from ._storages_operations import StoragesOperations +from ._certificates_operations import CertificatesOperations +from ._custom_domains_operations import CustomDomainsOperations +from ._deployments_operations import DeploymentsOperations +from ._operations import Operations +from ._runtime_versions_operations import RuntimeVersionsOperations +from ._skus_operations import SkusOperations +from ._gateways_operations import GatewaysOperations +from ._gateway_route_configs_operations import GatewayRouteConfigsOperations +from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations +from ._api_portals_operations import ApiPortalsOperations +from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations + +__all__ = [ + 'ServicesOperations', + 'ConfigServersOperations', + 'ConfigurationServicesOperations', + 'ServiceRegistriesOperations', + 'BuildServiceOperations', + 'BuildpackBindingOperations', + 'BuildServiceBuilderOperations', + 'BuildServiceAgentPoolOperations', + 'MonitoringSettingsOperations', + 'AppsOperations', + 'BindingsOperations', + 'StoragesOperations', + 'CertificatesOperations', + 'CustomDomainsOperations', + 'DeploymentsOperations', + 'Operations', + 'RuntimeVersionsOperations', + 'SkusOperations', + 'GatewaysOperations', + 'GatewayRouteConfigsOperations', + 'GatewayCustomDomainsOperations', + 'ApiPortalsOperations', + 'ApiPortalCustomDomainsOperations', +] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py new file mode 100644 index 00000000000..e422fc49e55 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py @@ -0,0 +1,633 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ApiPortalCustomDomainsOperations(object): + """ApiPortalCustomDomainsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + """Get the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> "_models.ApiPortalCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.ApiPortalCustomDomainResource"]: + """Create or update the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :param api_portal_custom_domain_resource: The API portal custom domain for the create or update + operation. + :type api_portal_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_portal_custom_domain_resource=api_portal_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the API portal custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param domain_name: The name of the API portal custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> Iterable["_models.ApiPortalCustomDomainResourceCollection"]: + """Handle requests to list all API portal custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py new file mode 100644 index 00000000000..4f4d9e417d1 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py @@ -0,0 +1,719 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + api_portal_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class ApiPortalsOperations(object): + """ApiPortalsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> "_models.ApiPortalResource": + """Get the API portal and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApiPortalResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> "_models.ApiPortalResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + api_portal_resource: "_models.ApiPortalResource", + **kwargs: Any + ) -> LROPoller["_models.ApiPortalResource"]: + """Create the default API portal or update the existing API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param api_portal_resource: The API portal for the create or update operation. + :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApiPortalResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_portal_resource=api_portal_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ApiPortalResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the default API portal. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ApiPortalResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApiPortalResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + api_portal_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param api_portal_name: The name of API portal. + :type api_portal_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_portal_name=api_portal_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py new file mode 100644 index 00000000000..bb28b7254a9 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py @@ -0,0 +1,1194 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + sync_status: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if sync_status is not None: + _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_set_active_deployments_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class AppsOperations(object): + """AppsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + sync_status: Optional[str] = None, + **kwargs: Any + ) -> "_models.AppResource": + """Get an App and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param sync_status: Indicates whether sync status. Default value is None. + :type sync_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AppResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + sync_status=sync_status, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: + """Create a new App or update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the create or update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(app_resource, 'AppResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + app_resource: "_models.AppResource", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: + """Operation to update an exiting App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param app_resource: Parameters for the update operation. + :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + app_resource=app_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.AppResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AppResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AppResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + + @distributed_trace + def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for an App, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + + + def _set_active_deployments_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> "_models.AppResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + + request = build_set_active_deployments_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._set_active_deployments_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AppResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AppResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + + @distributed_trace + def begin_set_active_deployments( + self, + resource_group_name: str, + service_name: str, + app_name: str, + active_deployment_collection: "_models.ActiveDeploymentCollection", + **kwargs: Any + ) -> LROPoller["_models.AppResource"]: + """Set existing Deployment under the app as active. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param active_deployment_collection: A list of Deployment name to be active. + :type active_deployment_collection: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._set_active_deployments_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + active_deployment_collection=active_deployment_collection, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('AppResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + app_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the resource name is valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py new file mode 100644 index 00000000000..cec117d6b31 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py @@ -0,0 +1,823 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BindingsOperations(object): + """BindingsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> "_models.BindingResource": + """Get a Binding and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: + """Create a new Binding or update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the create or update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> "_models.BindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(binding_resource, 'BindingResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + binding_name: str, + binding_resource: "_models.BindingResource", + **kwargs: Any + ) -> LROPoller["_models.BindingResource"]: + """Operation to update an exiting Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param binding_name: The name of the Binding resource. + :type binding_name: str + :param binding_resource: Parameters for the update operation. + :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + binding_name=binding_name, + binding_resource=binding_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.BindingResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BindingResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py new file mode 100644 index 00000000000..b092ac91e9f --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py @@ -0,0 +1,475 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class BuildServiceAgentPoolOperations(object): + """BuildServiceAgentPoolOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"]: + """List build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + """Get build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildServiceAgentPoolResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> "_models.BuildServiceAgentPoolResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + agent_pool_name: str, + agent_pool_resource: "_models.BuildServiceAgentPoolResource", + **kwargs: Any + ) -> LROPoller["_models.BuildServiceAgentPoolResource"]: + """Create or update build service agent pool. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param agent_pool_name: The name of the build service agent pool resource. + :type agent_pool_name: str + :param agent_pool_resource: Parameters for the update operation. + :type agent_pool_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + agent_pool_name=agent_pool_name, + agent_pool_resource=agent_pool_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py new file mode 100644 index 00000000000..a4a7c4b4983 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py @@ -0,0 +1,631 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BuildServiceBuilderOperations(object): + """BuildServiceBuilderOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> "_models.BuilderResource": + """Get a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuilderResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> "_models.BuilderResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(builder_resource, 'BuilderResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuilderResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + builder_resource: "_models.BuilderResource", + **kwargs: Any + ) -> LROPoller["_models.BuilderResource"]: + """Create or update a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param builder_resource: The target builder for the create or update operation. + :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + builder_resource=builder_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuilderResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a KPack builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuilderResourceCollection"]: + """List KPack builders result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuilderResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py new file mode 100644 index 00000000000..733d0685f2c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py @@ -0,0 +1,1506 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_build_services_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_service_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_builds_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_build_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_build_results_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_result_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_build_result_log_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildName": _SERIALIZER.url("build_name", build_name, 'str'), + "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_resource_upload_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_supported_buildpacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_supported_buildpack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_supported_stacks_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_supported_stack_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BuildServiceOperations(object): + """BuildServiceOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_build_services( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildServiceCollection"]: + """List build services resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildServiceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_build_services.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_services_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildServiceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + + @distributed_trace + def get_build_service( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.BuildService": + """Get a build service resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildService, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_service_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_build_service.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildService', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + + + @distributed_trace + def list_builds( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildCollection"]: + """List KPack builds. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildCollection or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_builds.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_builds_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + + @distributed_trace + def get_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> "_models.Build": + """Get a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.get_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace + def create_or_update_build( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build: "_models.Build", + **kwargs: Any + ) -> "_models.Build": + """Create or update a KPack build. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build: Parameters for the create or update operation. + :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Build, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(build, 'Build') + + request = build_create_or_update_build_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update_build.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Build', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Build', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + + + @distributed_trace + def list_build_results( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildResultCollection"]: + """List KPack build results. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildResultCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=self.list_build_results.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_build_results_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildResultCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + + @distributed_trace + def get_build_result( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResult": + """Get a KPack build result. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + + + @distributed_trace + def get_build_result_log( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + build_name: str, + build_result_name: str, + **kwargs: Any + ) -> "_models.BuildResultLog": + """Get a KPack build result log download URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param build_name: The name of the build resource. + :type build_name: str + :param build_result_name: The name of the build result resource. + :type build_result_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildResultLog, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultLog + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_build_result_log_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + build_name=build_name, + build_result_name=build_result_name, + api_version=api_version, + template_url=self.get_build_result_log.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildResultLog', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + + + @distributed_trace + def get_resource_upload_url( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.ResourceUploadDefinition": + """Get an resource upload URL for build service, which may be artifacts or source archive. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceUploadDefinition, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_resource_upload_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.get_resource_upload_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + + + @distributed_trace + def list_supported_buildpacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpacksCollection": + """Get all supported buildpacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_supported_buildpacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_buildpacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + + + @distributed_trace + def get_supported_buildpack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + buildpack_name: str, + **kwargs: Any + ) -> "_models.SupportedBuildpackResource": + """Get the supported buildpack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param buildpack_name: The name of the buildpack resource. + :type buildpack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedBuildpackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_supported_buildpack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + buildpack_name=buildpack_name, + api_version=api_version, + template_url=self.get_supported_buildpack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + + + @distributed_trace + def list_supported_stacks( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + **kwargs: Any + ) -> "_models.SupportedStacksCollection": + """Get all supported stacks. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStacksCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStacksCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_supported_stacks_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + api_version=api_version, + template_url=self.list_supported_stacks.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + + + @distributed_trace + def get_supported_stack( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + stack_name: str, + **kwargs: Any + ) -> "_models.SupportedStackResource": + """Get the supported stack resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param stack_name: The name of the stack resource. + :type stack_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SupportedStackResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_supported_stack_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + stack_name=stack_name, + api_version=api_version, + template_url=self.get_supported_stack.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SupportedStackResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py new file mode 100644 index 00000000000..b9a45d62628 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py @@ -0,0 +1,661 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), + "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class BuildpackBindingOperations(object): + """BuildpackBindingOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + """Get a buildpack binding by name. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BuildpackBindingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> "_models.BuildpackBindingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + buildpack_binding: "_models.BuildpackBindingResource", + **kwargs: Any + ) -> LROPoller["_models.BuildpackBindingResource"]: + """Create or update a buildpack binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :param buildpack_binding: The target buildpack binding for the create or update operation. + :type buildpack_binding: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + buildpack_binding=buildpack_binding, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + buildpack_binding_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Buildpack Binding. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :param buildpack_binding_name: The name of the Buildpack Binding Name. + :type buildpack_binding_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + buildpack_binding_name=buildpack_binding_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + build_service_name: str, + builder_name: str, + **kwargs: Any + ) -> Iterable["_models.BuildpackBindingResourceCollection"]: + """Handles requests to list all buildpack bindings in a builder. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param build_service_name: The name of the build service resource. + :type build_service_name: str + :param builder_name: The name of the builder resource. + :type builder_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + build_service_name=build_service_name, + builder_name=builder_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py new file mode 100644 index 00000000000..90a20d15344 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py @@ -0,0 +1,606 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class CertificatesOperations(object): + """CertificatesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> "_models.CertificateResource": + """Get the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> "_models.CertificateResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_resource, 'CertificateResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CertificateResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + certificate_resource: "_models.CertificateResource", + **kwargs: Any + ) -> LROPoller["_models.CertificateResource"]: + """Create or update certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :param certificate_resource: Parameters for the create or update operation. + :type certificate_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + certificate_resource=certificate_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + certificate_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the certificate resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param certificate_name: The name of the certificate resource. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + certificate_name=certificate_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateResourceCollection"]: + """List all the certificates of one user. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py new file mode 100644 index 00000000000..38b579a33bb --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py @@ -0,0 +1,667 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class ConfigServersOperations(object): + """ConfigServersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ConfigServerResource": + """Get the config server and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigServerResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> "_models.ConfigServerResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_resource, 'ConfigServerResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + config_server_resource: "_models.ConfigServerResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerResource"]: + """Update the config server. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_resource: Parameters for the update operation. + :type config_server_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_resource=config_server_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> "_models.ConfigServerSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + config_server_settings: "_models.ConfigServerSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: + """Check if the config server settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param config_server_settings: Config server settings to be validated. + :type config_server_settings: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + config_server_settings=config_server_settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py new file mode 100644 index 00000000000..3658e5a8145 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py @@ -0,0 +1,785 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class ConfigurationServicesOperations(object): + """ConfigurationServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + """Get the Application Configuration Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ConfigurationServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> "_models.ConfigurationServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + configuration_service_resource: "_models.ConfigurationServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceResource"]: + """Create the default Application Configuration Service or update the existing Application + Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param configuration_service_resource: Parameters for the update operation. + :type configuration_service_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationServiceResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + configuration_service_resource=configuration_service_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Application Configuration Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ConfigurationServiceResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> "_models.ConfigurationServiceSettingsValidateResult": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(settings, 'ConfigurationServiceSettings') + + request = build_validate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + service_name: str, + configuration_service_name: str, + settings: "_models.ConfigurationServiceSettings", + **kwargs: Any + ) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"]: + """Check if the Application Configuration Service settings are valid. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param configuration_service_name: The name of Application Configuration Service. + :type configuration_service_name: str + :param settings: Application Configuration Service settings to be validated. + :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either + ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + service_name=service_name, + configuration_service_name=configuration_service_name, + settings=settings, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py new file mode 100644 index 00000000000..10105b150f9 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py @@ -0,0 +1,823 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class CustomDomainsOperations(object): + """CustomDomainsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.CustomDomainResource": + """Get the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: + """Create or update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> "_models.CustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(domain_resource, 'CustomDomainResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + domain_name: str, + domain_resource: "_models.CustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.CustomDomainResource"]: + """Update custom domain of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param domain_name: The name of the custom domain resource. + :type domain_name: str + :param domain_resource: Parameters for the create or update operation. + :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + domain_name=domain_name, + domain_resource=domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + **kwargs: Any + ) -> Iterable["_models.CustomDomainResourceCollection"]: + """List the custom domains of one lifecycle application. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CustomDomainResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py new file mode 100644 index 00000000000..910bf1d888e --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py @@ -0,0 +1,2074 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_for_cluster_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + version: Optional[List[str]] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if version is not None: + _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_log_file_url_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_generate_heap_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_generate_thread_dump_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_start_jfr_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "appName": _SERIALIZER.url("app_name", app_name, 'str'), + "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class DeploymentsOperations(object): # pylint: disable=too-many-public-methods + """DeploymentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> "_models.DeploymentResource": + """Get a Deployment and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeploymentResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: + """Create a new Deployment or update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the create or update operation. + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> "_models.DeploymentResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(deployment_resource, 'DeploymentResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DeploymentResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + deployment_resource: "_models.DeploymentResource", + **kwargs: Any + ) -> LROPoller["_models.DeploymentResource"]: + """Operation to update an exiting Deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param deployment_resource: Parameters for the update operation. + :type deployment_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + deployment_resource=deployment_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + app_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: + """Handles requests to list all resources in an App. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + + @distributed_trace + def list_for_cluster( + self, + resource_group_name: str, + service_name: str, + version: Optional[List[str]] = None, + **kwargs: Any + ) -> Iterable["_models.DeploymentResourceCollection"]: + """List deployments for a certain service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param version: Version of the deployments to be listed. Default value is None. + :type version: list[str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeploymentResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=self.list_for_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_for_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + version=version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Start the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Stop the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + + @distributed_trace + def begin_restart( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Restart the deployment. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + + @distributed_trace + def get_log_file_url( + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + **kwargs: Any + ) -> Optional["_models.LogFileUrlResponse"]: + """Get deployment log file URL. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LogFileUrlResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.LogFileUrlResponse or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_log_file_url_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + template_url=self.get_log_file_url.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + + + def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_heap_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_heap_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + + @distributed_trace + def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Heap Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._generate_heap_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + + def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_generate_thread_dump_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._generate_thread_dump_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + + @distributed_trace + def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: + """Generate Thread Dump. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._generate_thread_dump_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + + def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + + request = build_start_jfr_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._start_jfr_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + + + @distributed_trace + def begin_start_jfr( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + app_name: str, + deployment_name: str, + diagnostic_parameters: "_models.DiagnosticParameters", + **kwargs: Any + ) -> LROPoller[None]: + """Start JFR. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param app_name: The name of the App resource. + :type app_name: str + :param deployment_name: The name of the Deployment resource. + :type deployment_name: str + :param diagnostic_parameters: Parameters for the diagnostic operation. + :type diagnostic_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_jfr_initial( + resource_group_name=resource_group_name, + service_name=service_name, + app_name=app_name, + deployment_name=deployment_name, + diagnostic_parameters=diagnostic_parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py new file mode 100644 index 00000000000..a0520c689f0 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py @@ -0,0 +1,633 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class GatewayCustomDomainsOperations(object): + """GatewayCustomDomainsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + """Get the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayCustomDomainResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> "_models.GatewayCustomDomainResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayCustomDomainResource"]: + """Create or update the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :param gateway_custom_domain_resource: The gateway custom domain resource for the create or + update operation. + :type gateway_custom_domain_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + gateway_custom_domain_resource=gateway_custom_domain_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + domain_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the Spring Cloud Gateway custom domain. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param domain_name: The name of the Spring Cloud Gateway custom domain. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + domain_name=domain_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayCustomDomainResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway custom domains. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py new file mode 100644 index 00000000000..28ff32b2f6a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py @@ -0,0 +1,634 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class GatewayRouteConfigsOperations(object): + """GatewayRouteConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + """Get the Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayRouteConfigResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> "_models.GatewayRouteConfigResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + gateway_route_config_resource: "_models.GatewayRouteConfigResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayRouteConfigResource"]: + """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud + Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or + update operation. + :type gateway_route_config_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + gateway_route_config_resource=gateway_route_config_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + route_config_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the Spring Cloud Gateway route config. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param route_config_name: The name of the Spring Cloud Gateway route config. + :type route_config_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + route_config_name=route_config_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayRouteConfigResourceCollection"]: + """Handle requests to list all Spring Cloud Gateway route configs. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py new file mode 100644 index 00000000000..e609f373487 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py @@ -0,0 +1,719 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_validate_domain_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + gateway_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class GatewaysOperations(object): + """GatewaysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> "_models.GatewayResource": + """Get the Spring Cloud Gateway and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GatewayResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GatewayResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> "_models.GatewayResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(gateway_resource, 'GatewayResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('GatewayResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('GatewayResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + gateway_resource: "_models.GatewayResource", + **kwargs: Any + ) -> LROPoller["_models.GatewayResource"]: + """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param gateway_resource: The gateway for the create or update operation. + :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + gateway_resource=gateway_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('GatewayResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Spring Cloud Gateway. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.GatewayResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GatewayResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + + @distributed_trace + def validate_domain( + self, + resource_group_name: str, + service_name: str, + gateway_name: str, + validate_payload: "_models.CustomDomainValidatePayload", + **kwargs: Any + ) -> "_models.CustomDomainValidateResult": + """Check the domains are valid as well as not in use. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param gateway_name: The name of Spring Cloud Gateway. + :type gateway_name: str + :param validate_payload: Custom domain payload to be validated. + :type validate_payload: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomDomainValidateResult, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + + request = build_validate_domain_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + gateway_name=gateway_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_domain.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py new file mode 100644 index 00000000000..568d1ddf555 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py @@ -0,0 +1,493 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_put_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_patch_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class MonitoringSettingsOperations(object): + """MonitoringSettingsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + """Get the Monitoring Setting and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MonitoringSettingResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + def _update_put_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_put_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_put_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace + def begin_update_put( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_put_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + def _update_patch_initial( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> "_models.MonitoringSettingResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + + request = build_update_patch_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_patch_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + + + @distributed_trace + def begin_update_patch( + self, + resource_group_name: str, + service_name: str, + monitoring_setting_resource: "_models.MonitoringSettingResource", + **kwargs: Any + ) -> LROPoller["_models.MonitoringSettingResource"]: + """Update the Monitoring Setting. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param monitoring_setting_resource: Parameters for the update operation. + :type monitoring_setting_resource: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_patch_initial( + resource_group_name=resource_group_name, + service_name=service_name, + monitoring_setting_resource=monitoring_setting_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py new file mode 100644 index 00000000000..c4057762256 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: + """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py new file mode 100644 index 00000000000..b099daba723 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py @@ -0,0 +1,122 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_runtime_versions_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class RuntimeVersionsOperations(object): + """RuntimeVersionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_runtime_versions( + self, + **kwargs: Any + ) -> "_models.AvailableRuntimeVersions": + """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailableRuntimeVersions, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableRuntimeVersions + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_runtime_versions_request( + api_version=api_version, + template_url=self.list_runtime_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py new file mode 100644 index 00000000000..d3a04dd5738 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py @@ -0,0 +1,582 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ServiceRegistriesOperations(object): + """ServiceRegistriesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + """Get the Service Registry and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceRegistryResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> "_models.ServiceRegistryResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller["_models.ServiceRegistryResource"]: + """Create the default Service Registry or update the existing Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + service_registry_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Disable the default Service Registry. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param service_registry_name: The name of Service Registry. + :type service_registry_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + service_registry_name=service_registry_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceRegistryResourceCollection"]: + """Handles requests to list all resources in a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py new file mode 100644 index 00000000000..7bd2702945c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py @@ -0,0 +1,1630 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_test_keys_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_regenerate_test_key_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_disable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_enable_test_endpoint_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ServicesOperations(object): + """ServicesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": + """Get a Service and its properties. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: + """Create a new Service or update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the create or update operation. + :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Operation to delete a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'ServiceResource') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + service_name: str, + resource: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: + """Operation to update an exiting Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param resource: Parameters for the update operation. + :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + resource=resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + + @distributed_trace + def list_test_keys( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """List test keys for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_list_test_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list_test_keys.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + + + @distributed_trace + def regenerate_test_key( + self, + resource_group_name: str, + service_name: str, + regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", + **kwargs: Any + ) -> "_models.TestKeys": + """Regenerate a test key for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param regenerate_test_key_request: Parameters for the operation. + :type regenerate_test_key_request: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + + request = build_regenerate_test_key_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.regenerate_test_key.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + + + @distributed_trace + def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + """Disable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_disable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.disable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + + + @distributed_trace + def enable_test_endpoint( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.TestKeys": + """Enable test endpoint functionality for a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: TestKeys, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_enable_test_endpoint_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.enable_test_endpoint.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TestKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + + + @distributed_trace + def begin_stop( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Stop a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + + + @distributed_trace + def begin_start( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Start a Service. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + + @distributed_trace + def check_name_availability( + self, + location: str, + availability_parameters: "_models.NameAvailabilityParameters", + **kwargs: Any + ) -> "_models.NameAvailability": + """Checks that the resource name is valid and is not already in use. + + :param location: the region. + :type location: str + :param availability_parameters: Parameters supplied to the operation. + :type availability_parameters: + ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NameAvailability, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NameAvailability', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: + """Handles requests to list all resources in a resource group. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServiceResourceList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py new file mode 100644 index 00000000000..a49de3f263f --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py @@ -0,0 +1,153 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class SkusOperations(object): + """SkusOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.ResourceSkuCollection"]: + """Lists all of the available skus of the Microsoft.AppPlatform provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceSkuCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py new file mode 100644 index 00000000000..ec3d2a79801 --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py @@ -0,0 +1,605 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # 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'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class StoragesOperations(object): + """StoragesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> "_models.StorageResource": + """Get the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param storage_name: The name of the storage resource. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageResource, or the result of cls(response) + :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('StorageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> "_models.StorageResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_resource, 'StorageResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('StorageResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + service_name: str, + storage_name: str, + storage_resource: "_models.StorageResource", + **kwargs: Any + ) -> LROPoller["_models.StorageResource"]: + """Create or update storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param storage_name: The name of the storage resource. + :type storage_name: str + :param storage_resource: Parameters for the create or update operation. + :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either StorageResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + storage_resource=storage_resource, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + service_name: str, + storage_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete the storage resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :param storage_name: The name of the storage resource. + :type storage_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + service_name=service_name, + storage_name=storage_name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + service_name: str, + **kwargs: Any + ) -> Iterable["_models.StorageResourceCollection"]: + """List all the storages of one Azure Spring Apps resource. + + :param resource_group_name: The name of the resource group that contains the resource. You can + obtain this value from the Azure Resource Manager API or the portal. + :type resource_group_name: str + :param service_name: The name of the Service resource. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageResourceCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResourceCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + service_name=service_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StorageResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore From 937cca16f7636676431f409fc638f3bbd2dfc45d Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Wed, 18 May 2022 15:19:49 +0800 Subject: [PATCH 02/21] update sdk --- .../azext_spring/vendored_sdks/__init__.py | 2 +- .../_app_platform_management_client.py | 195 +- .../appplatform/_configuration.py | 4 +- .../aio/_app_platform_management_client.py | 195 +- .../appplatform/aio/_configuration.py | 4 +- .../vendored_sdks/appplatform/models.py | 3 +- .../appplatform/v2020_07_01/__init__.py | 9 +- .../_app_platform_management_client.py | 137 +- .../appplatform/v2020_07_01/_configuration.py | 31 +- .../appplatform/v2020_07_01/aio/__init__.py | 5 - .../aio/_app_platform_management_client.py | 129 +- .../v2020_07_01/aio/_configuration.py | 18 +- .../aio/operations/_apps_operations.py | 488 ++- .../aio/operations/_bindings_operations.py | 400 ++- .../operations/_certificates_operations.py | 287 +- .../operations/_config_servers_operations.py | 327 +- .../operations/_custom_domains_operations.py | 400 ++- .../aio/operations/_deployments_operations.py | 757 ++--- .../_monitoring_settings_operations.py | 241 +- .../v2020_07_01/aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 656 ++-- .../aio/operations/_skus_operations.py | 70 +- .../v2020_07_01/models/__init__.py | 209 +- .../_app_platform_management_client_enums.py | 53 +- .../v2020_07_01/models/_models_py3.py | 1318 +++----- .../operations/_apps_operations.py | 905 ++---- .../operations/_bindings_operations.py | 735 ++--- .../operations/_certificates_operations.py | 524 ++- .../operations/_config_servers_operations.py | 582 ++-- .../operations/_custom_domains_operations.py | 735 ++--- .../operations/_deployments_operations.py | 1400 +++----- .../_monitoring_settings_operations.py | 430 +-- .../v2020_07_01/operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1217 +++---- .../operations/_skus_operations.py | 118 +- .../v2020_11_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 149 +- .../v2020_11_01_preview/_configuration.py | 31 +- .../v2020_11_01_preview/aio/__init__.py | 5 - .../aio/_app_platform_management_client.py | 135 +- .../v2020_11_01_preview/aio/_configuration.py | 18 +- .../aio/operations/_apps_operations.py | 491 ++- .../aio/operations/_bindings_operations.py | 400 ++- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../operations/_custom_domains_operations.py | 400 ++- .../aio/operations/_deployments_operations.py | 763 ++--- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 656 ++-- .../aio/operations/_skus_operations.py | 70 +- .../v2020_11_01_preview/models/__init__.py | 212 +- .../_app_platform_management_client_enums.py | 53 +- .../v2020_11_01_preview/models/_models_py3.py | 1365 +++----- .../operations/_apps_operations.py | 914 ++---- .../operations/_bindings_operations.py | 735 ++--- .../operations/_certificates_operations.py | 527 ++- .../operations/_config_servers_operations.py | 591 ++-- .../operations/_custom_domains_operations.py | 735 ++--- .../operations/_deployments_operations.py | 1406 +++----- .../_monitoring_settings_operations.py | 430 +-- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1217 +++---- .../operations/_skus_operations.py | 118 +- .../v2021_06_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 149 +- .../v2021_06_01_preview/_configuration.py | 31 +- .../v2021_06_01_preview/aio/__init__.py | 5 - .../aio/_app_platform_management_client.py | 135 +- .../v2021_06_01_preview/aio/_configuration.py | 18 +- .../aio/operations/_apps_operations.py | 491 ++- .../aio/operations/_bindings_operations.py | 400 ++- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../operations/_custom_domains_operations.py | 400 ++- .../aio/operations/_deployments_operations.py | 763 ++--- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 656 ++-- .../aio/operations/_skus_operations.py | 70 +- .../v2021_06_01_preview/models/__init__.py | 221 +- .../_app_platform_management_client_enums.py | 53 +- .../v2021_06_01_preview/models/_models_py3.py | 1451 +++------ .../operations/_apps_operations.py | 914 ++---- .../operations/_bindings_operations.py | 735 ++--- .../operations/_certificates_operations.py | 527 ++- .../operations/_config_servers_operations.py | 591 ++-- .../operations/_custom_domains_operations.py | 735 ++--- .../operations/_deployments_operations.py | 1406 +++----- .../_monitoring_settings_operations.py | 430 +-- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1217 +++---- .../operations/_skus_operations.py | 118 +- .../v2021_09_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 153 +- .../v2021_09_01_preview/_configuration.py | 31 +- .../v2021_09_01_preview/_version.py | 2 +- .../v2021_09_01_preview/aio/__init__.py | 5 - .../aio/_app_platform_management_client.py | 139 +- .../v2021_09_01_preview/aio/_configuration.py | 18 +- .../aio/operations/_apps_operations.py | 491 ++- .../aio/operations/_bindings_operations.py | 400 ++- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../operations/_custom_domains_operations.py | 400 ++- .../aio/operations/_deployments_operations.py | 1053 +++--- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../aio/operations/_services_operations.py | 796 +++-- .../aio/operations/_skus_operations.py | 70 +- .../aio/operations/_storages_operations.py | 287 +- .../v2021_09_01_preview/models/__init__.py | 264 +- .../_app_platform_management_client_enums.py | 71 +- .../v2021_09_01_preview/models/_models_py3.py | 1718 +++------- .../operations/_apps_operations.py | 914 ++---- .../operations/_bindings_operations.py | 735 ++--- .../operations/_certificates_operations.py | 527 ++- .../operations/_config_servers_operations.py | 591 ++-- .../operations/_custom_domains_operations.py | 735 ++--- .../operations/_deployments_operations.py | 1932 ++++------- .../_monitoring_settings_operations.py | 430 +-- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../operations/_services_operations.py | 1465 +++------ .../operations/_skus_operations.py | 118 +- .../operations/_storages_operations.py | 524 ++- .../v2022_01_01_preview/__init__.py | 9 +- .../_app_platform_management_client.py | 227 +- .../v2022_01_01_preview/_configuration.py | 31 +- .../v2022_01_01_preview/aio/__init__.py | 5 - .../aio/_app_platform_management_client.py | 213 +- .../v2022_01_01_preview/aio/_configuration.py | 18 +- .../_api_portal_custom_domains_operations.py | 305 +- .../aio/operations/_api_portals_operations.py | 347 +- .../aio/operations/_apps_operations.py | 589 ++-- .../aio/operations/_bindings_operations.py | 400 ++- .../_build_service_agent_pool_operations.py | 235 +- .../_build_service_builder_operations.py | 302 +- .../operations/_build_service_operations.py | 674 ++-- .../_buildpack_binding_operations.py | 316 +- .../operations/_certificates_operations.py | 290 +- .../operations/_config_servers_operations.py | 336 +- .../_configuration_services_operations.py | 385 ++- .../operations/_custom_domains_operations.py | 400 ++- .../aio/operations/_deployments_operations.py | 1053 +++--- .../_gateway_custom_domains_operations.py | 305 +- .../_gateway_route_configs_operations.py | 305 +- .../aio/operations/_gateways_operations.py | 347 +- .../_monitoring_settings_operations.py | 241 +- .../aio/operations/_operations.py | 59 +- .../_runtime_versions_operations.py | 46 +- .../_service_registries_operations.py | 270 +- .../aio/operations/_services_operations.py | 796 +++-- .../aio/operations/_skus_operations.py | 70 +- .../aio/operations/_storages_operations.py | 287 +- .../v2022_01_01_preview/models/__init__.py | 507 ++- .../_app_platform_management_client_enums.py | 91 +- .../v2022_01_01_preview/models/_models_py3.py | 2868 +++++------------ .../_api_portal_custom_domains_operations.py | 562 ++-- .../operations/_api_portals_operations.py | 643 ++-- .../operations/_apps_operations.py | 1084 +++---- .../operations/_bindings_operations.py | 735 ++--- .../_build_service_agent_pool_operations.py | 422 +-- .../_build_service_builder_operations.py | 559 ++-- .../operations/_build_service_operations.py | 1364 +++----- .../_buildpack_binding_operations.py | 593 ++-- .../operations/_certificates_operations.py | 527 ++- .../operations/_config_servers_operations.py | 591 ++-- .../_configuration_services_operations.py | 694 ++-- .../operations/_custom_domains_operations.py | 735 ++--- .../operations/_deployments_operations.py | 1932 ++++------- .../_gateway_custom_domains_operations.py | 562 ++-- .../_gateway_route_configs_operations.py | 562 ++-- .../operations/_gateways_operations.py | 643 ++-- .../_monitoring_settings_operations.py | 430 +-- .../operations/_operations.py | 101 +- .../_runtime_versions_operations.py | 88 +- .../_service_registries_operations.py | 494 +-- .../operations/_services_operations.py | 1465 +++------ .../operations/_skus_operations.py | 118 +- .../operations/_storages_operations.py | 524 ++- .../_app_platform_management_client.py | 14 +- .../v2022_03_01_preview/_configuration.py | 12 +- .../aio/_app_platform_management_client.py | 12 +- .../v2022_03_01_preview/aio/_configuration.py | 12 +- .../_api_portal_custom_domains_operations.py | 71 +- .../aio/operations/_api_portals_operations.py | 81 +- .../aio/operations/_apps_operations.py | 132 +- .../aio/operations/_bindings_operations.py | 90 +- .../_build_service_agent_pool_operations.py | 47 +- .../_build_service_builder_operations.py | 71 +- .../operations/_build_service_operations.py | 150 +- .../_buildpack_binding_operations.py | 71 +- .../operations/_certificates_operations.py | 71 +- .../operations/_config_servers_operations.py | 73 +- .../_configuration_services_operations.py | 90 +- .../operations/_custom_domains_operations.py | 90 +- .../aio/operations/_deployments_operations.py | 260 +- .../_gateway_custom_domains_operations.py | 71 +- .../_gateway_route_configs_operations.py | 71 +- .../aio/operations/_gateways_operations.py | 81 +- .../_monitoring_settings_operations.py | 54 +- .../aio/operations/_operations.py | 18 +- .../_runtime_versions_operations.py | 16 +- .../_service_registries_operations.py | 72 +- .../aio/operations/_services_operations.py | 205 +- .../aio/operations/_skus_operations.py | 18 +- .../aio/operations/_storages_operations.py | 71 +- .../v2022_03_01_preview/models/__init__.py | 4 - .../_app_platform_management_client_enums.py | 12 - .../v2022_03_01_preview/models/_models_py3.py | 26 +- .../_api_portal_custom_domains_operations.py | 159 +- .../operations/_api_portals_operations.py | 191 +- .../operations/_apps_operations.py | 309 +- .../operations/_bindings_operations.py | 200 +- .../_build_service_agent_pool_operations.py | 114 +- .../_build_service_builder_operations.py | 159 +- .../operations/_build_service_operations.py | 427 +-- .../_buildpack_binding_operations.py | 159 +- .../operations/_certificates_operations.py | 159 +- .../operations/_config_servers_operations.py | 163 +- .../_configuration_services_operations.py | 200 +- .../operations/_custom_domains_operations.py | 200 +- .../operations/_deployments_operations.py | 545 ++-- .../_gateway_custom_domains_operations.py | 159 +- .../_gateway_route_configs_operations.py | 159 +- .../operations/_gateways_operations.py | 191 +- .../_monitoring_settings_operations.py | 122 +- .../operations/_operations.py | 39 +- .../_runtime_versions_operations.py | 38 +- .../_service_registries_operations.py | 159 +- .../operations/_services_operations.py | 485 ++- .../operations/_skus_operations.py | 41 +- .../operations/_storages_operations.py | 159 +- 241 files changed, 34235 insertions(+), 53317 deletions(-) diff --git a/src/spring/azext_spring/vendored_sdks/__init__.py b/src/spring/azext_spring/vendored_sdks/__init__.py index 8db66d3d0f0..0260537a02b 100644 --- a/src/spring/azext_spring/vendored_sdks/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py index 1497bb5f150..440ca96d17f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/_app_platform_management_client.py @@ -11,11 +11,10 @@ from typing import TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer from ._configuration import AppPlatformManagementClientConfiguration @@ -33,7 +32,7 @@ def __init__(self, *args, **kwargs): pass class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): - """REST API for Azure Spring Apps. + """REST API for Azure Spring Cloud. This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). @@ -56,11 +55,12 @@ class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-04-01' + DEFAULT_API_VERSION = '2020-07-01' _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'sku': '2019-05-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -89,16 +89,18 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: + * 2019-05-01-preview: :mod:`v2019_05_01_preview.models` * 2020-07-01: :mod:`v2020_07_01.models` * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` * 2022-03-01-preview: :mod:`v2022_03_01_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` """ - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview import models + return models + elif api_version == '2020-07-01': from .v2020_07_01 import models return models elif api_version == '2020-11-01-preview': @@ -116,12 +118,6 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-03-01-preview': from .v2022_03_01_preview import models return models - elif api_version == '2022-04-01': - from .v2022_04_01 import models - return models - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview import models - return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -130,15 +126,12 @@ def api_portal_custom_domains(self): * 2022-01-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2022-03-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-05-01-preview: :class:`ApiPortalCustomDomainsOperations` """ api_version = self._get_api_version('api_portal_custom_domains') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ApiPortalCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -149,15 +142,12 @@ def api_portals(self): * 2022-01-01-preview: :class:`ApiPortalsOperations` * 2022-03-01-preview: :class:`ApiPortalsOperations` - * 2022-05-01-preview: :class:`ApiPortalsOperations` """ api_version = self._get_api_version('api_portals') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ApiPortalsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ApiPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -166,17 +156,18 @@ def api_portals(self): def apps(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`AppsOperations` * 2020-07-01: :class:`AppsOperations` * 2020-11-01-preview: :class:`AppsOperations` * 2021-06-01-preview: :class:`AppsOperations` * 2021-09-01-preview: :class:`AppsOperations` * 2022-01-01-preview: :class:`AppsOperations` * 2022-03-01-preview: :class:`AppsOperations` - * 2022-04-01: :class:`AppsOperations` - * 2022-05-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import AppsOperations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import AppsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import AppsOperations as OperationClass @@ -188,10 +179,6 @@ def apps(self): from .v2022_01_01_preview.operations import AppsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import AppsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import AppsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import AppsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -200,17 +187,18 @@ def apps(self): def bindings(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`BindingsOperations` * 2020-07-01: :class:`BindingsOperations` * 2020-11-01-preview: :class:`BindingsOperations` * 2021-06-01-preview: :class:`BindingsOperations` * 2021-09-01-preview: :class:`BindingsOperations` * 2022-01-01-preview: :class:`BindingsOperations` * 2022-03-01-preview: :class:`BindingsOperations` - * 2022-04-01: :class:`BindingsOperations` - * 2022-05-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import BindingsOperations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import BindingsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import BindingsOperations as OperationClass @@ -222,10 +210,6 @@ def bindings(self): from .v2022_01_01_preview.operations import BindingsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BindingsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BindingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -236,18 +220,12 @@ def build_service(self): * 2022-01-01-preview: :class:`BuildServiceOperations` * 2022-03-01-preview: :class:`BuildServiceOperations` - * 2022-04-01: :class:`BuildServiceOperations` - * 2022-05-01-preview: :class:`BuildServiceOperations` """ api_version = self._get_api_version('build_service') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildServiceOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -258,18 +236,12 @@ def build_service_agent_pool(self): * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` * 2022-03-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-04-01: :class:`BuildServiceAgentPoolOperations` - * 2022-05-01-preview: :class:`BuildServiceAgentPoolOperations` """ api_version = self._get_api_version('build_service_agent_pool') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildServiceAgentPoolOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -280,18 +252,12 @@ def build_service_builder(self): * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` * 2022-03-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-04-01: :class:`BuildServiceBuilderOperations` - * 2022-05-01-preview: :class:`BuildServiceBuilderOperations` """ api_version = self._get_api_version('build_service_builder') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildServiceBuilderOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildServiceBuilderOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -302,18 +268,12 @@ def buildpack_binding(self): * 2022-01-01-preview: :class:`BuildpackBindingOperations` * 2022-03-01-preview: :class:`BuildpackBindingOperations` - * 2022-04-01: :class:`BuildpackBindingOperations` - * 2022-05-01-preview: :class:`BuildpackBindingOperations` """ api_version = self._get_api_version('buildpack_binding') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import BuildpackBindingOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import BuildpackBindingOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -322,17 +282,18 @@ def buildpack_binding(self): def certificates(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`CertificatesOperations` * 2020-07-01: :class:`CertificatesOperations` * 2020-11-01-preview: :class:`CertificatesOperations` * 2021-06-01-preview: :class:`CertificatesOperations` * 2021-09-01-preview: :class:`CertificatesOperations` * 2022-01-01-preview: :class:`CertificatesOperations` * 2022-03-01-preview: :class:`CertificatesOperations` - * 2022-04-01: :class:`CertificatesOperations` - * 2022-05-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import CertificatesOperations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import CertificatesOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import CertificatesOperations as OperationClass @@ -344,10 +305,6 @@ def certificates(self): from .v2022_01_01_preview.operations import CertificatesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import CertificatesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import CertificatesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -362,8 +319,6 @@ def config_servers(self): * 2021-09-01-preview: :class:`ConfigServersOperations` * 2022-01-01-preview: :class:`ConfigServersOperations` * 2022-03-01-preview: :class:`ConfigServersOperations` - * 2022-04-01: :class:`ConfigServersOperations` - * 2022-05-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -378,10 +333,6 @@ def config_servers(self): from .v2022_01_01_preview.operations import ConfigServersOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ConfigServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -392,18 +343,12 @@ def configuration_services(self): * 2022-01-01-preview: :class:`ConfigurationServicesOperations` * 2022-03-01-preview: :class:`ConfigurationServicesOperations` - * 2022-04-01: :class:`ConfigurationServicesOperations` - * 2022-05-01-preview: :class:`ConfigurationServicesOperations` """ api_version = self._get_api_version('configuration_services') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ConfigurationServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ConfigurationServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -412,17 +357,18 @@ def configuration_services(self): def custom_domains(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`CustomDomainsOperations` * 2020-07-01: :class:`CustomDomainsOperations` * 2020-11-01-preview: :class:`CustomDomainsOperations` * 2021-06-01-preview: :class:`CustomDomainsOperations` * 2021-09-01-preview: :class:`CustomDomainsOperations` * 2022-01-01-preview: :class:`CustomDomainsOperations` * 2022-03-01-preview: :class:`CustomDomainsOperations` - * 2022-04-01: :class:`CustomDomainsOperations` - * 2022-05-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import CustomDomainsOperations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import CustomDomainsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import CustomDomainsOperations as OperationClass @@ -434,10 +380,6 @@ def custom_domains(self): from .v2022_01_01_preview.operations import CustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import CustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -446,17 +388,18 @@ def custom_domains(self): def deployments(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`DeploymentsOperations` * 2020-07-01: :class:`DeploymentsOperations` * 2020-11-01-preview: :class:`DeploymentsOperations` * 2021-06-01-preview: :class:`DeploymentsOperations` * 2021-09-01-preview: :class:`DeploymentsOperations` * 2022-01-01-preview: :class:`DeploymentsOperations` * 2022-03-01-preview: :class:`DeploymentsOperations` - * 2022-04-01: :class:`DeploymentsOperations` - * 2022-05-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import DeploymentsOperations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import DeploymentsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import DeploymentsOperations as OperationClass @@ -468,10 +411,6 @@ def deployments(self): from .v2022_01_01_preview.operations import DeploymentsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -482,15 +421,12 @@ def gateway_custom_domains(self): * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` * 2022-03-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-05-01-preview: :class:`GatewayCustomDomainsOperations` """ api_version = self._get_api_version('gateway_custom_domains') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import GatewayCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import GatewayCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -501,15 +437,12 @@ def gateway_route_configs(self): * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` * 2022-03-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-05-01-preview: :class:`GatewayRouteConfigsOperations` """ api_version = self._get_api_version('gateway_route_configs') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import GatewayRouteConfigsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import GatewayRouteConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -520,15 +453,12 @@ def gateways(self): * 2022-01-01-preview: :class:`GatewaysOperations` * 2022-03-01-preview: :class:`GatewaysOperations` - * 2022-05-01-preview: :class:`GatewaysOperations` """ api_version = self._get_api_version('gateways') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import GatewaysOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import GatewaysOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import GatewaysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -543,8 +473,6 @@ def monitoring_settings(self): * 2021-09-01-preview: :class:`MonitoringSettingsOperations` * 2022-01-01-preview: :class:`MonitoringSettingsOperations` * 2022-03-01-preview: :class:`MonitoringSettingsOperations` - * 2022-04-01: :class:`MonitoringSettingsOperations` - * 2022-05-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -559,10 +487,6 @@ def monitoring_settings(self): from .v2022_01_01_preview.operations import MonitoringSettingsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import MonitoringSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -571,17 +495,18 @@ def monitoring_settings(self): def operations(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`Operations` * 2020-07-01: :class:`Operations` * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-09-01-preview: :class:`Operations` * 2022-01-01-preview: :class:`Operations` * 2022-03-01-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-05-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import Operations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import Operations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import Operations as OperationClass @@ -593,10 +518,6 @@ def operations(self): from .v2022_01_01_preview.operations import Operations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import Operations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import Operations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -605,17 +526,18 @@ def operations(self): def runtime_versions(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`RuntimeVersionsOperations` * 2020-07-01: :class:`RuntimeVersionsOperations` * 2020-11-01-preview: :class:`RuntimeVersionsOperations` * 2021-06-01-preview: :class:`RuntimeVersionsOperations` * 2021-09-01-preview: :class:`RuntimeVersionsOperations` * 2022-01-01-preview: :class:`RuntimeVersionsOperations` * 2022-03-01-preview: :class:`RuntimeVersionsOperations` - * 2022-04-01: :class:`RuntimeVersionsOperations` - * 2022-05-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import RuntimeVersionsOperations as OperationClass @@ -627,10 +549,6 @@ def runtime_versions(self): from .v2022_01_01_preview.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import RuntimeVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -641,18 +559,12 @@ def service_registries(self): * 2022-01-01-preview: :class:`ServiceRegistriesOperations` * 2022-03-01-preview: :class:`ServiceRegistriesOperations` - * 2022-04-01: :class:`ServiceRegistriesOperations` - * 2022-05-01-preview: :class:`ServiceRegistriesOperations` """ api_version = self._get_api_version('service_registries') if api_version == '2022-01-01-preview': from .v2022_01_01_preview.operations import ServiceRegistriesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ServiceRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -661,17 +573,18 @@ def service_registries(self): def services(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`ServicesOperations` * 2020-07-01: :class:`ServicesOperations` * 2020-11-01-preview: :class:`ServicesOperations` * 2021-06-01-preview: :class:`ServicesOperations` * 2021-09-01-preview: :class:`ServicesOperations` * 2022-01-01-preview: :class:`ServicesOperations` * 2022-03-01-preview: :class:`ServicesOperations` - * 2022-04-01: :class:`ServicesOperations` - * 2022-05-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import ServicesOperations as OperationClass + elif api_version == '2020-07-01': from .v2020_07_01.operations import ServicesOperations as OperationClass elif api_version == '2020-11-01-preview': from .v2020_11_01_preview.operations import ServicesOperations as OperationClass @@ -683,14 +596,23 @@ def services(self): from .v2022_01_01_preview.operations import ServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import ServicesOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import ServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import ServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def sku(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`SkuOperations` + """ + api_version = self._get_api_version('sku') + if api_version == '2019-05-01-preview': + from .v2019_05_01_preview.operations import SkuOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'sku'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def skus(self): """Instance depends on the API version: @@ -701,8 +623,6 @@ def skus(self): * 2021-09-01-preview: :class:`SkusOperations` * 2022-01-01-preview: :class:`SkusOperations` * 2022-03-01-preview: :class:`SkusOperations` - * 2022-04-01: :class:`SkusOperations` - * 2022-05-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -717,10 +637,6 @@ def skus(self): from .v2022_01_01_preview.operations import SkusOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import SkusOperations as OperationClass - elif api_version == '2022-04-01': - from .v2022_04_01.operations import SkusOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -732,7 +648,6 @@ def storages(self): * 2021-09-01-preview: :class:`StoragesOperations` * 2022-01-01-preview: :class:`StoragesOperations` * 2022-03-01-preview: :class:`StoragesOperations` - * 2022-05-01-preview: :class:`StoragesOperations` """ api_version = self._get_api_version('storages') if api_version == '2021-09-01-preview': @@ -741,8 +656,6 @@ def storages(self): from .v2022_01_01_preview.operations import StoragesOperations as OperationClass elif api_version == '2022-03-01-preview': from .v2022_03_01_preview.operations import StoragesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from .v2022_05_01_preview.operations import StoragesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py index 60e24d4ade1..7ab9f3c3d51 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py index 70fafb7c0fa..7a2a1c5bfe7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_app_platform_management_client.py @@ -11,11 +11,10 @@ from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer from ._configuration import AppPlatformManagementClientConfiguration @@ -32,7 +31,7 @@ def __init__(self, *args, **kwargs): pass class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): - """REST API for Azure Spring Apps. + """REST API for Azure Spring Cloud. This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). @@ -55,11 +54,12 @@ class AppPlatformManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2022-04-01' + DEFAULT_API_VERSION = '2020-07-01' _PROFILE_TAG = "azure.mgmt.appplatform.AppPlatformManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, + 'sku': '2019-05-01-preview', }}, _PROFILE_TAG + " latest" ) @@ -88,16 +88,18 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: + * 2019-05-01-preview: :mod:`v2019_05_01_preview.models` * 2020-07-01: :mod:`v2020_07_01.models` * 2020-11-01-preview: :mod:`v2020_11_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-09-01-preview: :mod:`v2021_09_01_preview.models` * 2022-01-01-preview: :mod:`v2022_01_01_preview.models` * 2022-03-01-preview: :mod:`v2022_03_01_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-05-01-preview: :mod:`v2022_05_01_preview.models` """ - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview import models + return models + elif api_version == '2020-07-01': from ..v2020_07_01 import models return models elif api_version == '2020-11-01-preview': @@ -115,12 +117,6 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview import models return models - elif api_version == '2022-04-01': - from ..v2022_04_01 import models - return models - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview import models - return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -129,15 +125,12 @@ def api_portal_custom_domains(self): * 2022-01-01-preview: :class:`ApiPortalCustomDomainsOperations` * 2022-03-01-preview: :class:`ApiPortalCustomDomainsOperations` - * 2022-05-01-preview: :class:`ApiPortalCustomDomainsOperations` """ api_version = self._get_api_version('api_portal_custom_domains') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ApiPortalCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portal_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -148,15 +141,12 @@ def api_portals(self): * 2022-01-01-preview: :class:`ApiPortalsOperations` * 2022-03-01-preview: :class:`ApiPortalsOperations` - * 2022-05-01-preview: :class:`ApiPortalsOperations` """ api_version = self._get_api_version('api_portals') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ApiPortalsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ApiPortalsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ApiPortalsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'api_portals'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -165,17 +155,18 @@ def api_portals(self): def apps(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`AppsOperations` * 2020-07-01: :class:`AppsOperations` * 2020-11-01-preview: :class:`AppsOperations` * 2021-06-01-preview: :class:`AppsOperations` * 2021-09-01-preview: :class:`AppsOperations` * 2022-01-01-preview: :class:`AppsOperations` * 2022-03-01-preview: :class:`AppsOperations` - * 2022-04-01: :class:`AppsOperations` - * 2022-05-01-preview: :class:`AppsOperations` """ api_version = self._get_api_version('apps') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import AppsOperations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import AppsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import AppsOperations as OperationClass @@ -187,10 +178,6 @@ def apps(self): from ..v2022_01_01_preview.aio.operations import AppsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import AppsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import AppsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import AppsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'apps'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -199,17 +186,18 @@ def apps(self): def bindings(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`BindingsOperations` * 2020-07-01: :class:`BindingsOperations` * 2020-11-01-preview: :class:`BindingsOperations` * 2021-06-01-preview: :class:`BindingsOperations` * 2021-09-01-preview: :class:`BindingsOperations` * 2022-01-01-preview: :class:`BindingsOperations` * 2022-03-01-preview: :class:`BindingsOperations` - * 2022-04-01: :class:`BindingsOperations` - * 2022-05-01-preview: :class:`BindingsOperations` """ api_version = self._get_api_version('bindings') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import BindingsOperations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import BindingsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import BindingsOperations as OperationClass @@ -221,10 +209,6 @@ def bindings(self): from ..v2022_01_01_preview.aio.operations import BindingsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BindingsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BindingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BindingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'bindings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -235,18 +219,12 @@ def build_service(self): * 2022-01-01-preview: :class:`BuildServiceOperations` * 2022-03-01-preview: :class:`BuildServiceOperations` - * 2022-04-01: :class:`BuildServiceOperations` - * 2022-05-01-preview: :class:`BuildServiceOperations` """ api_version = self._get_api_version('build_service') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildServiceOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildServiceOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildServiceOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -257,18 +235,12 @@ def build_service_agent_pool(self): * 2022-01-01-preview: :class:`BuildServiceAgentPoolOperations` * 2022-03-01-preview: :class:`BuildServiceAgentPoolOperations` - * 2022-04-01: :class:`BuildServiceAgentPoolOperations` - * 2022-05-01-preview: :class:`BuildServiceAgentPoolOperations` """ api_version = self._get_api_version('build_service_agent_pool') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildServiceAgentPoolOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildServiceAgentPoolOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_agent_pool'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -279,18 +251,12 @@ def build_service_builder(self): * 2022-01-01-preview: :class:`BuildServiceBuilderOperations` * 2022-03-01-preview: :class:`BuildServiceBuilderOperations` - * 2022-04-01: :class:`BuildServiceBuilderOperations` - * 2022-05-01-preview: :class:`BuildServiceBuilderOperations` """ api_version = self._get_api_version('build_service_builder') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildServiceBuilderOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildServiceBuilderOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'build_service_builder'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -301,18 +267,12 @@ def buildpack_binding(self): * 2022-01-01-preview: :class:`BuildpackBindingOperations` * 2022-03-01-preview: :class:`BuildpackBindingOperations` - * 2022-04-01: :class:`BuildpackBindingOperations` - * 2022-05-01-preview: :class:`BuildpackBindingOperations` """ api_version = self._get_api_version('buildpack_binding') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import BuildpackBindingOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import BuildpackBindingOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import BuildpackBindingOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'buildpack_binding'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -321,17 +281,18 @@ def buildpack_binding(self): def certificates(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`CertificatesOperations` * 2020-07-01: :class:`CertificatesOperations` * 2020-11-01-preview: :class:`CertificatesOperations` * 2021-06-01-preview: :class:`CertificatesOperations` * 2021-09-01-preview: :class:`CertificatesOperations` * 2022-01-01-preview: :class:`CertificatesOperations` * 2022-03-01-preview: :class:`CertificatesOperations` - * 2022-04-01: :class:`CertificatesOperations` - * 2022-05-01-preview: :class:`CertificatesOperations` """ api_version = self._get_api_version('certificates') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import CertificatesOperations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import CertificatesOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import CertificatesOperations as OperationClass @@ -343,10 +304,6 @@ def certificates(self): from ..v2022_01_01_preview.aio.operations import CertificatesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import CertificatesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import CertificatesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'certificates'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -361,8 +318,6 @@ def config_servers(self): * 2021-09-01-preview: :class:`ConfigServersOperations` * 2022-01-01-preview: :class:`ConfigServersOperations` * 2022-03-01-preview: :class:`ConfigServersOperations` - * 2022-04-01: :class:`ConfigServersOperations` - * 2022-05-01-preview: :class:`ConfigServersOperations` """ api_version = self._get_api_version('config_servers') if api_version == '2020-07-01': @@ -377,10 +332,6 @@ def config_servers(self): from ..v2022_01_01_preview.aio.operations import ConfigServersOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ConfigServersOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ConfigServersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'config_servers'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -391,18 +342,12 @@ def configuration_services(self): * 2022-01-01-preview: :class:`ConfigurationServicesOperations` * 2022-03-01-preview: :class:`ConfigurationServicesOperations` - * 2022-04-01: :class:`ConfigurationServicesOperations` - * 2022-05-01-preview: :class:`ConfigurationServicesOperations` """ api_version = self._get_api_version('configuration_services') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ConfigurationServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ConfigurationServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'configuration_services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -411,17 +356,18 @@ def configuration_services(self): def custom_domains(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`CustomDomainsOperations` * 2020-07-01: :class:`CustomDomainsOperations` * 2020-11-01-preview: :class:`CustomDomainsOperations` * 2021-06-01-preview: :class:`CustomDomainsOperations` * 2021-09-01-preview: :class:`CustomDomainsOperations` * 2022-01-01-preview: :class:`CustomDomainsOperations` * 2022-03-01-preview: :class:`CustomDomainsOperations` - * 2022-04-01: :class:`CustomDomainsOperations` - * 2022-05-01-preview: :class:`CustomDomainsOperations` """ api_version = self._get_api_version('custom_domains') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import CustomDomainsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import CustomDomainsOperations as OperationClass @@ -433,10 +379,6 @@ def custom_domains(self): from ..v2022_01_01_preview.aio.operations import CustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import CustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import CustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -445,17 +387,18 @@ def custom_domains(self): def deployments(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`DeploymentsOperations` * 2020-07-01: :class:`DeploymentsOperations` * 2020-11-01-preview: :class:`DeploymentsOperations` * 2021-06-01-preview: :class:`DeploymentsOperations` * 2021-09-01-preview: :class:`DeploymentsOperations` * 2022-01-01-preview: :class:`DeploymentsOperations` * 2022-03-01-preview: :class:`DeploymentsOperations` - * 2022-04-01: :class:`DeploymentsOperations` - * 2022-05-01-preview: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import DeploymentsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import DeploymentsOperations as OperationClass @@ -467,10 +410,6 @@ def deployments(self): from ..v2022_01_01_preview.aio.operations import DeploymentsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import DeploymentsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -481,15 +420,12 @@ def gateway_custom_domains(self): * 2022-01-01-preview: :class:`GatewayCustomDomainsOperations` * 2022-03-01-preview: :class:`GatewayCustomDomainsOperations` - * 2022-05-01-preview: :class:`GatewayCustomDomainsOperations` """ api_version = self._get_api_version('gateway_custom_domains') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import GatewayCustomDomainsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_custom_domains'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -500,15 +436,12 @@ def gateway_route_configs(self): * 2022-01-01-preview: :class:`GatewayRouteConfigsOperations` * 2022-03-01-preview: :class:`GatewayRouteConfigsOperations` - * 2022-05-01-preview: :class:`GatewayRouteConfigsOperations` """ api_version = self._get_api_version('gateway_route_configs') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import GatewayRouteConfigsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateway_route_configs'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -519,15 +452,12 @@ def gateways(self): * 2022-01-01-preview: :class:`GatewaysOperations` * 2022-03-01-preview: :class:`GatewaysOperations` - * 2022-05-01-preview: :class:`GatewaysOperations` """ api_version = self._get_api_version('gateways') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import GatewaysOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import GatewaysOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import GatewaysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'gateways'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -542,8 +472,6 @@ def monitoring_settings(self): * 2021-09-01-preview: :class:`MonitoringSettingsOperations` * 2022-01-01-preview: :class:`MonitoringSettingsOperations` * 2022-03-01-preview: :class:`MonitoringSettingsOperations` - * 2022-04-01: :class:`MonitoringSettingsOperations` - * 2022-05-01-preview: :class:`MonitoringSettingsOperations` """ api_version = self._get_api_version('monitoring_settings') if api_version == '2020-07-01': @@ -558,10 +486,6 @@ def monitoring_settings(self): from ..v2022_01_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import MonitoringSettingsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import MonitoringSettingsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'monitoring_settings'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -570,17 +494,18 @@ def monitoring_settings(self): def operations(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`Operations` * 2020-07-01: :class:`Operations` * 2020-11-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-09-01-preview: :class:`Operations` * 2022-01-01-preview: :class:`Operations` * 2022-03-01-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-05-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import Operations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import Operations as OperationClass @@ -592,10 +517,6 @@ def operations(self): from ..v2022_01_01_preview.aio.operations import Operations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import Operations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -604,17 +525,18 @@ def operations(self): def runtime_versions(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`RuntimeVersionsOperations` * 2020-07-01: :class:`RuntimeVersionsOperations` * 2020-11-01-preview: :class:`RuntimeVersionsOperations` * 2021-06-01-preview: :class:`RuntimeVersionsOperations` * 2021-09-01-preview: :class:`RuntimeVersionsOperations` * 2022-01-01-preview: :class:`RuntimeVersionsOperations` * 2022-03-01-preview: :class:`RuntimeVersionsOperations` - * 2022-04-01: :class:`RuntimeVersionsOperations` - * 2022-05-01-preview: :class:`RuntimeVersionsOperations` """ api_version = self._get_api_version('runtime_versions') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass @@ -626,10 +548,6 @@ def runtime_versions(self): from ..v2022_01_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import RuntimeVersionsOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import RuntimeVersionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'runtime_versions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -640,18 +558,12 @@ def service_registries(self): * 2022-01-01-preview: :class:`ServiceRegistriesOperations` * 2022-03-01-preview: :class:`ServiceRegistriesOperations` - * 2022-04-01: :class:`ServiceRegistriesOperations` - * 2022-05-01-preview: :class:`ServiceRegistriesOperations` """ api_version = self._get_api_version('service_registries') if api_version == '2022-01-01-preview': from ..v2022_01_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ServiceRegistriesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ServiceRegistriesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'service_registries'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -660,17 +572,18 @@ def service_registries(self): def services(self): """Instance depends on the API version: + * 2019-05-01-preview: :class:`ServicesOperations` * 2020-07-01: :class:`ServicesOperations` * 2020-11-01-preview: :class:`ServicesOperations` * 2021-06-01-preview: :class:`ServicesOperations` * 2021-09-01-preview: :class:`ServicesOperations` * 2022-01-01-preview: :class:`ServicesOperations` * 2022-03-01-preview: :class:`ServicesOperations` - * 2022-04-01: :class:`ServicesOperations` - * 2022-05-01-preview: :class:`ServicesOperations` """ api_version = self._get_api_version('services') - if api_version == '2020-07-01': + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import ServicesOperations as OperationClass + elif api_version == '2020-07-01': from ..v2020_07_01.aio.operations import ServicesOperations as OperationClass elif api_version == '2020-11-01-preview': from ..v2020_11_01_preview.aio.operations import ServicesOperations as OperationClass @@ -682,14 +595,23 @@ def services(self): from ..v2022_01_01_preview.aio.operations import ServicesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import ServicesOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import ServicesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import ServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'services'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def sku(self): + """Instance depends on the API version: + + * 2019-05-01-preview: :class:`SkuOperations` + """ + api_version = self._get_api_version('sku') + if api_version == '2019-05-01-preview': + from ..v2019_05_01_preview.aio.operations import SkuOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'sku'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def skus(self): """Instance depends on the API version: @@ -700,8 +622,6 @@ def skus(self): * 2021-09-01-preview: :class:`SkusOperations` * 2022-01-01-preview: :class:`SkusOperations` * 2022-03-01-preview: :class:`SkusOperations` - * 2022-04-01: :class:`SkusOperations` - * 2022-05-01-preview: :class:`SkusOperations` """ api_version = self._get_api_version('skus') if api_version == '2020-07-01': @@ -716,10 +636,6 @@ def skus(self): from ..v2022_01_01_preview.aio.operations import SkusOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import SkusOperations as OperationClass - elif api_version == '2022-04-01': - from ..v2022_04_01.aio.operations import SkusOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import SkusOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'skus'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -731,7 +647,6 @@ def storages(self): * 2021-09-01-preview: :class:`StoragesOperations` * 2022-01-01-preview: :class:`StoragesOperations` * 2022-03-01-preview: :class:`StoragesOperations` - * 2022-05-01-preview: :class:`StoragesOperations` """ api_version = self._get_api_version('storages') if api_version == '2021-09-01-preview': @@ -740,8 +655,6 @@ def storages(self): from ..v2022_01_01_preview.aio.operations import StoragesOperations as OperationClass elif api_version == '2022-03-01-preview': from ..v2022_03_01_preview.aio.operations import StoragesOperations as OperationClass - elif api_version == '2022-05-01-preview': - from ..v2022_05_01_preview.aio.operations import StoragesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'storages'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py index 10eb9d6f0e9..d383d0e0754 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/models.py b/src/spring/azext_spring/vendored_sdks/appplatform/models.py index 7d9f8183c1a..d1b4c8d0d9b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/models.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/models.py @@ -4,4 +4,5 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2022_04_01.models import * +from .v2019_05_01_preview.models import * +from .v2020_07_01.models import * diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py index 41ec6d71ff7..d2ddf950056 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/__init__.py @@ -12,7 +12,8 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py index 6d7ae544c6a..bbb07fef27c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_app_platform_management_client.py @@ -6,23 +6,34 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from . import models + -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -30,8 +41,7 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :ivar config_servers: ConfigServersOperations operations :vartype config_servers: azure.mgmt.appplatform.v2020_07_01.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2020_07_01.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_07_01.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -45,76 +55,75 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_07_01.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2020_07_01.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2020_07_01.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_07_01.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2020-07-01". 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. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - + self._deserialize = Deserializer(client_models) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse + :rtype: ~azure.core.pipeline.transport.HttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py index d275183a2af..2e027c53459 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_configuration.py @@ -6,20 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any + from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,31 +29,26 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2020-07-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -71,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py index 44ce4a5043f..39f10548873 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/__init__.py @@ -8,8 +8,3 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py index a183031693f..497d1a0e0b0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_app_platform_management_client.py @@ -6,33 +6,40 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .. import models + + +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_07_01.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2020_07_01.aio.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2020_07_01.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2020_07_01.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2020_07_01.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_07_01.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -40,83 +47,79 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :ivar certificates: CertificatesOperations operations :vartype certificates: azure.mgmt.appplatform.v2020_07_01.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2020_07_01.aio.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2020_07_01.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations :vartype deployments: azure.mgmt.appplatform.v2020_07_01.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_07_01.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2020_07_01.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2020_07_01.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_07_01.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2020-07-01". 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. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - + self._deserialize = Deserializer(client_models) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py index fe974e61f1b..101a93f7aef 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,12 +27,8 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-07-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -41,17 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2020-07-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -70,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py index c8185f126f4..96a7b447e45 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,7 +60,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,27 +72,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +109,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _create_or_update_initial( self, @@ -127,30 +124,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -170,11 +171,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -196,20 +194,14 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -223,22 +215,28 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,11 +246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -264,26 +262,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -293,11 +294,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -315,17 +314,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,18 +334,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,9 +362,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _update_initial( self, @@ -376,30 +379,34 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -416,11 +423,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,20 +446,14 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -469,22 +467,28 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,11 +498,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace def list( self, resource_group_name: str, @@ -513,48 +516,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,11 +563,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,13 +572,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -609,26 +603,29 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,11 +638,8 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -675,30 +669,34 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -711,6 +709,4 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py index a5ad80d960f..732cfe5da5c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py index 6f03d9552dd..6407846b0e5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,11 +166,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -192,20 +189,14 @@ async def begin_create_or_update( :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -219,22 +210,28 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -244,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -260,26 +257,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,11 +289,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -311,17 +309,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,18 +329,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,11 +357,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -374,48 +375,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -424,11 +422,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -437,8 +431,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py index 88c5815fdad..7e48efe0d06 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -178,20 +176,14 @@ async def begin_update_put( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -204,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -229,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_patch_initial( self, @@ -245,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -284,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -307,20 +305,14 @@ async def begin_update_patch( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -333,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -358,9 +355,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _validate_initial( self, @@ -374,29 +371,33 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -413,11 +414,8 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -436,20 +434,14 @@ async def begin_validate( :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -462,22 +454,27 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -487,6 +484,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py index 4a037502866..46bb8daccbc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py index 988d0302576..36566cc712b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,55 +539,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -591,11 +592,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -604,13 +601,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -625,53 +620,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -680,11 +672,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -693,13 +681,12 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -712,27 +699,30 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -742,11 +732,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -767,17 +755,14 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -791,18 +776,26 @@ async def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -812,11 +805,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -829,27 +822,30 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -859,11 +855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -884,17 +878,14 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -908,18 +899,26 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -929,11 +928,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, service_name: str, @@ -946,27 +945,30 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -976,11 +978,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements + async def begin_restart( self, resource_group_name: str, service_name: str, @@ -1001,17 +1001,14 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1025,18 +1022,26 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1046,11 +1051,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1080,27 +1084,30 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1115,6 +1122,4 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py index 61082351ede..4dc1442371f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,6 +355,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py index ab4aa3d1ff9..d114e98657e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -53,40 +49,38 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,11 +89,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,8 +98,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py index c2ea04af068..1d3ccd3dbfe 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,18 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._runtime_versions_operations import build_list_runtime_versions_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -60,22 +56,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,6 +84,4 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py index ea48483c3ad..092b2ee09fc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -71,25 +66,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,9 +100,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _create_or_update_initial( self, @@ -118,29 +114,33 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,11 +160,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -183,20 +180,14 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -209,22 +200,27 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -234,11 +230,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -249,25 +245,28 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -277,11 +276,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -296,17 +293,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -318,18 +312,24 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _update_initial( self, @@ -355,29 +355,33 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -394,11 +398,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,20 +418,14 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -443,22 +438,27 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,11 +468,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -496,25 +495,28 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -527,11 +529,8 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -547,8 +546,7 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys @@ -559,29 +557,33 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -594,12 +596,9 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + async def disable_test_endpoint( self, resource_group_name: str, service_name: str, @@ -622,25 +621,28 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -650,10 +652,8 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,25 +677,28 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -708,11 +711,8 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,8 +724,7 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability @@ -736,28 +735,32 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -770,11 +773,8 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,42 +783,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -827,11 +827,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -840,13 +836,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -859,44 +853,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,11 +898,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -918,8 +907,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py index e105e348611..c7de60e3a3f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -52,44 +48,43 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,11 +93,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,8 +102,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py index e4dbda7bd1b..5659fe3dbc3 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/__init__.py @@ -6,78 +6,146 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AvailableOperations -from ._models_py3 import AvailableRuntimeVersions -from ._models_py3 import BindingResource -from ._models_py3 import BindingResourceCollection -from ._models_py3 import BindingResourceProperties -from ._models_py3 import CertificateProperties -from ._models_py3 import CertificateResource -from ._models_py3 import CertificateResourceCollection -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterResourceProperties -from ._models_py3 import ConfigServerGitProperty -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerSettings -from ._models_py3 import ConfigServerSettingsErrorRecord -from ._models_py3 import ConfigServerSettingsValidateResult -from ._models_py3 import CustomDomainProperties -from ._models_py3 import CustomDomainResource -from ._models_py3 import CustomDomainResourceCollection -from ._models_py3 import CustomDomainValidatePayload -from ._models_py3 import CustomDomainValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import Error -from ._models_py3 import GitPatternRepository -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import MonitoringSettingProperties -from ._models_py3 import MonitoringSettingResource -from ._models_py3 import NameAvailability -from ._models_py3 import NameAvailabilityParameters -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileOutboundIPs -from ._models_py3 import OperationDetail -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationProperties -from ._models_py3 import PersistentDisk -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RequiredTraffic -from ._models_py3 import Resource -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuCapabilities -from ._models_py3 import ResourceSkuCollection -from ._models_py3 import ResourceSkuLocationInfo -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import ResourceSkuZoneDetails -from ._models_py3 import ResourceUploadDefinition -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceList -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import TemporaryDisk -from ._models_py3 import TestKeys -from ._models_py3 import TrackedResource -from ._models_py3 import UserSourceInfo - +try: + from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection + from ._models_py3 import AppResourceProperties + from ._models_py3 import AvailableOperations + from ._models_py3 import AvailableRuntimeVersions + from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection + from ._models_py3 import BindingResourceProperties + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody + from ._models_py3 import ClusterResourceProperties + from ._models_py3 import ConfigServerGitProperty + from ._models_py3 import ConfigServerProperties + from ._models_py3 import ConfigServerResource + from ._models_py3 import ConfigServerSettings + from ._models_py3 import ConfigServerSettingsErrorRecord + from ._models_py3 import ConfigServerSettingsValidateResult + from ._models_py3 import CustomDomainProperties + from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection + from ._models_py3 import CustomDomainValidatePayload + from ._models_py3 import CustomDomainValidateResult + from ._models_py3 import DeploymentInstance + from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection + from ._models_py3 import DeploymentResourceProperties + from ._models_py3 import DeploymentSettings + from ._models_py3 import Error + from ._models_py3 import GitPatternRepository + from ._models_py3 import LogFileUrlResponse + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentityProperties + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification + from ._models_py3 import MonitoringSettingProperties + from ._models_py3 import MonitoringSettingResource + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters + from ._models_py3 import NetworkProfile + from ._models_py3 import NetworkProfileOutboundIPs + from ._models_py3 import OperationDetail + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationProperties + from ._models_py3 import PersistentDisk + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateTestKeyRequestPayload + from ._models_py3 import RequiredTraffic + from ._models_py3 import Resource + from ._models_py3 import ResourceSku + from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection + from ._models_py3 import ResourceSkuLocationInfo + from ._models_py3 import ResourceSkuRestrictionInfo + from ._models_py3 import ResourceSkuRestrictions + from ._models_py3 import ResourceSkuZoneDetails + from ._models_py3 import ResourceUploadDefinition + from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import SkuCapacity + from ._models_py3 import SupportedRuntimeVersion + from ._models_py3 import TemporaryDisk + from ._models_py3 import TestKeys + from ._models_py3 import TrackedResource + from ._models_py3 import UserSourceInfo +except (SyntaxError, ImportError): + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( - ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -165,7 +233,6 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', - 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py index 48326092115..5ac8dede62c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_app_platform_management_client_enums.py @@ -6,18 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) - INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -26,7 +35,7 @@ class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -36,7 +45,7 @@ class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -45,7 +54,7 @@ class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -57,7 +66,7 @@ class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -66,7 +75,7 @@ class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -75,7 +84,7 @@ class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -89,7 +98,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -97,14 +106,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -112,7 +121,7 @@ class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -120,14 +129,14 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -135,21 +144,21 @@ class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py index 011dec21acc..b1dad0b57a2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/models/_models_py3.py @@ -42,8 +42,6 @@ def __init__( self, **kwargs ): - """ - """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -79,8 +77,6 @@ def __init__( self, **kwargs ): - """ - """ super(ProxyResource, self).__init__(**kwargs) @@ -95,12 +91,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties - :ivar location: The GEO location of the application, always the same with its parent resource. - :vartype location: str + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. + :type location: str """ _validation = { @@ -126,15 +122,6 @@ def __init__( location: Optional[str] = None, **kwargs ): - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -144,11 +131,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of App resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -163,13 +150,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -180,26 +160,26 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar public: Indicates whether the App exposes public endpoint. - :vartype public: bool + :param public: Indicates whether the App exposes public endpoint. + :type public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.AppResourceProvisioningState - :ivar active_deployment_name: Name of the active deployment of the App. - :vartype active_deployment_name: str - :ivar fqdn: Fully qualified dns Name. - :vartype fqdn: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool + :param active_deployment_name: Name of the active deployment of the App. + :type active_deployment_name: str + :param fqdn: Fully qualified dns Name. + :type fqdn: str + :param https_only: Indicate if only https is allowed. + :type https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :ivar temporary_disk: Temporary disk settings. - :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk """ _validation = { @@ -231,20 +211,6 @@ def __init__( persistent_disk: Optional["PersistentDisk"] = None, **kwargs ): - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword active_deployment_name: Name of the active deployment of the App. - :paramtype active_deployment_name: str - :keyword fqdn: Fully qualified dns Name. - :paramtype fqdn: str - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword temporary_disk: Temporary disk settings. - :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_07_01.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_07_01.models.PersistentDisk - """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -260,11 +226,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -279,13 +245,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.OperationDetail] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -312,8 +271,6 @@ def __init__( self, **kwargs ): - """ - """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -329,8 +286,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Binding resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties """ _validation = { @@ -352,10 +309,6 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceProperties - """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -363,11 +316,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :ivar value: Collection of Binding resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -382,13 +335,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -403,12 +349,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :ivar resource_id: The Azure resource id of the bound resource. - :vartype resource_id: str - :ivar key: The key of the bound resource. - :vartype key: str - :ivar binding_parameters: Binding parameters of the Binding resource. - :vartype binding_parameters: dict[str, any] + :param resource_id: The Azure resource id of the bound resource. + :type resource_id: str + :param key: The key of the bound resource. + :type key: str + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -445,14 +391,6 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): - """ - :keyword resource_id: The Azure resource id of the bound resource. - :paramtype resource_id: str - :keyword key: The key of the bound resource. - :paramtype key: str - :keyword binding_parameters: Binding parameters of the Binding resource. - :paramtype binding_parameters: dict[str, any] - """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -473,12 +411,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :ivar vault_uri: Required. The vault uri of user key vault. - :vartype vault_uri: str - :ivar key_vault_cert_name: Required. The certificate name of key vault. - :vartype key_vault_cert_name: str - :ivar cert_version: The certificate version of key vault. - :vartype cert_version: str + :param vault_uri: Required. The vault uri of user key vault. + :type vault_uri: str + :param key_vault_cert_name: Required. The certificate name of key vault. + :type key_vault_cert_name: str + :param cert_version: The certificate version of key vault. + :type cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -526,14 +464,6 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): - """ - :keyword vault_uri: Required. The vault uri of user key vault. - :paramtype vault_uri: str - :keyword key_vault_cert_name: Required. The certificate name of key vault. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -558,8 +488,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties """ _validation = { @@ -581,10 +511,6 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateProperties - """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -592,10 +518,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :ivar value: The certificate resources list. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :ivar next_link: The link to next page of certificate list. - :vartype next_link: str + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { @@ -610,12 +536,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -624,17 +544,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + :param code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in + :type message: str + :param target: The target of the particular error. For example, the name of the property in error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] """ _attribute_map = { @@ -653,19 +573,6 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.appplatform.v2020_07_01.models.CloudErrorBody] - """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -683,8 +590,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -710,10 +617,6 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfile - """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -726,26 +629,26 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar repositories: Repositories of git. - :vartype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param repositories: Repositories of git. + :type repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -780,28 +683,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword repositories: Repositories of git. - :paramtype repositories: list[~azure.mgmt.appplatform.v2020_07_01.models.GitPatternRepository] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -824,10 +705,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings + :param error: Error when apply config server settings. + :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :param config_server: Settings of config server. + :type config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings """ _validation = { @@ -847,12 +728,6 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings - """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -870,8 +745,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties """ _validation = { @@ -893,10 +768,6 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerProperties - """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -904,8 +775,8 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :ivar git_property: Property of git environment. - :vartype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty + :param git_property: Property of git environment. + :type git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty """ _attribute_map = { @@ -918,10 +789,6 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerGitProperty - """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -929,12 +796,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :ivar name: The name of the config server settings error record. - :vartype name: str - :ivar uri: The uri of the config server settings error record. - :vartype uri: str - :ivar messages: The detail error messages of the record. - :vartype messages: list[str] + :param name: The name of the config server settings error record. + :type name: str + :param uri: The uri of the config server settings error record. + :type uri: str + :param messages: The detail error messages of the record. + :type messages: list[str] """ _attribute_map = { @@ -951,14 +818,6 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): - """ - :keyword name: The name of the config server settings error record. - :paramtype name: str - :keyword uri: The uri of the config server settings error record. - :paramtype uri: str - :keyword messages: The detail error messages of the record. - :paramtype messages: list[str] - """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -968,11 +827,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :ivar is_valid: Indicate if the config server settings are valid. - :vartype is_valid: bool - :ivar details: The detail validation results. - :vartype details: - list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] + :param is_valid: Indicate if the config server settings are valid. + :type is_valid: bool + :param details: The detail validation results. + :type details: list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] """ _attribute_map = { @@ -987,13 +845,6 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): - """ - :keyword is_valid: Indicate if the config server settings are valid. - :paramtype is_valid: bool - :keyword details: The detail validation results. - :paramtype details: - list[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsErrorRecord] - """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -1004,12 +855,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str + :param thumbprint: The thumbprint of bound certificate. + :type thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :ivar cert_name: The bound certificate name of domain. - :vartype cert_name: str + :param cert_name: The bound certificate name of domain. + :type cert_name: str """ _validation = { @@ -1029,12 +880,6 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -1052,8 +897,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties + :param properties: Properties of the custom domain resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties """ _validation = { @@ -1075,10 +920,6 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainProperties - """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -1086,10 +927,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :ivar value: The custom domain resources list. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :ivar next_link: The link to next page of custom domain list. - :vartype next_link: str + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str """ _attribute_map = { @@ -1104,12 +945,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1120,8 +955,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name to be validated. - :vartype name: str + :param name: Required. Name to be validated. + :type name: str """ _validation = { @@ -1138,10 +973,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword name: Required. Name to be validated. - :paramtype name: str - """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1149,10 +980,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :ivar is_valid: Indicates if domain name is valid. - :vartype is_valid: bool - :ivar message: Message of why domain name is invalid. - :vartype message: str + :param is_valid: Indicates if domain name is valid. + :type is_valid: bool + :param message: Message of why domain name is invalid. + :type message: str """ _attribute_map = { @@ -1167,12 +998,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword is_valid: Indicates if domain name is valid. - :paramtype is_valid: bool - :keyword message: Message of why domain name is invalid. - :paramtype message: str - """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1215,8 +1040,6 @@ def __init__( self, **kwargs ): - """ - """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1236,10 +1059,10 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Deployment resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :param properties: Properties of the Deployment resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties + :param sku: Sku of the Deployment resource. + :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -1263,12 +1086,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku - """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1277,11 +1094,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of Deployment resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1296,13 +1113,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1313,12 +1123,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar source: Uploaded source information of the deployment. - :vartype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo + :param source: Uploaded source information of the deployment. + :type source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings + :param deployment_settings: Deployment settings of the Deployment. + :type deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". :vartype provisioning_state: str or @@ -1361,12 +1171,6 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentSettings - """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1381,20 +1185,20 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :vartype cpu: int - :ivar memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :type cpu: int + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard tier should be in range (1, 8). - :vartype memory_in_gb: int - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. - :vartype net_core_main_entry_path: str - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :type memory_in_gb: int + :param jvm_options: JVM parameter. + :type jvm_options: str + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. + :type net_core_main_entry_path: str + :param environment_variables: Collection of environment variables. + :type environment_variables: dict[str, str] + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :vartype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion + :type runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion """ _attribute_map = { @@ -1417,22 +1221,6 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): - """ - :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :paramtype cpu: int - :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), - standard tier should be in range (1, 8). - :paramtype memory_in_gb: int - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. - :paramtype net_core_main_entry_path: str - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", - "NetCore_31". Default value: "Java_8". - :paramtype runtime_version: str or ~azure.mgmt.appplatform.v2020_07_01.models.RuntimeVersion - """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1445,10 +1233,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :ivar code: The code of error. - :vartype code: str - :ivar message: The message of error. - :vartype message: str + :param code: The code of error. + :type code: str + :param message: The message of error. + :type message: str """ _attribute_map = { @@ -1463,12 +1251,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1479,28 +1261,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param name: Required. Name of the repository. + :type name: str + :param pattern: Collection of pattern of the repository. + :type pattern: list[str] + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -1538,30 +1320,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1581,8 +1339,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar url: Required. URL of the log file. - :vartype url: str + :param url: Required. URL of the log file. + :type url: str """ _validation = { @@ -1599,10 +1357,6 @@ def __init__( url: str, **kwargs ): - """ - :keyword url: Required. URL of the log file. - :paramtype url: str - """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1610,12 +1364,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str """ _attribute_map = { @@ -1632,14 +1386,6 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1649,13 +1395,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType - :ivar principal_id: Principal Id. - :vartype principal_id: str - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType + :param principal_id: Principal Id. + :type principal_id: str + :param tenant_id: Tenant Id. + :type tenant_id: str """ _attribute_map = { @@ -1672,15 +1418,6 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): - """ - :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ManagedIdentityType - :keyword principal_id: Principal Id. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1690,13 +1427,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :param name: Name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :vartype to_be_exported_for_shoebox: bool + :type to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1713,15 +1450,6 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :paramtype to_be_exported_for_shoebox: bool - """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1731,31 +1459,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: Unit that makes sense for the metric. + :type unit: str + :param category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :type category: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :type aggregation_type: str + :param supported_aggregation_types: Supported aggregation types. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: Supported time grain types. + :type supported_time_grain_types: list[str] + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] - :ivar source_mdm_namespace: Name of the MDM namespace. Optional. - :vartype source_mdm_namespace: str + :type fill_gap_with_zero: bool + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] + :param source_mdm_namespace: Name of the MDM namespace. Optional. + :type source_mdm_namespace: str """ _attribute_map = { @@ -1788,33 +1516,6 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1838,12 +1539,12 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :ivar trace_enabled: Indicates whether enable the trace functionality. - :vartype trace_enabled: bool - :ivar app_insights_instrumentation_key: Target application insight instrumentation key. - :vartype app_insights_instrumentation_key: str + :param error: Error when apply Monitoring Setting changes. + :type error: ~azure.mgmt.appplatform.v2020_07_01.models.Error + :param trace_enabled: Indicates whether enable the trace functionality. + :type trace_enabled: bool + :param app_insights_instrumentation_key: Target application insight instrumentation key. + :type app_insights_instrumentation_key: str """ _validation = { @@ -1865,14 +1566,6 @@ def __init__( app_insights_instrumentation_key: Optional[str] = None, **kwargs ): - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2020_07_01.models.Error - :keyword trace_enabled: Indicates whether enable the trace functionality. - :paramtype trace_enabled: bool - :keyword app_insights_instrumentation_key: Target application insight instrumentation key. - :paramtype app_insights_instrumentation_key: str - """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1891,8 +1584,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties + :param properties: Properties of the Monitoring Setting resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties """ _validation = { @@ -1914,10 +1607,6 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingProperties - """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -1925,12 +1614,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: Reason why the name is not available. - :vartype reason: str - :ivar message: Message why the name is not available. - :vartype message: str + :param name_available: Indicates whether the name is available. + :type name_available: bool + :param reason: Reason why the name is not available. + :type reason: str + :param message: Message why the name is not available. + :type message: str """ _attribute_map = { @@ -1947,14 +1636,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword name_available: Indicates whether the name is available. - :paramtype name_available: bool - :keyword reason: Reason why the name is not available. - :paramtype reason: str - :keyword message: Message why the name is not available. - :paramtype message: str - """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -1966,10 +1647,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the resource to check name availability. - :vartype type: str - :ivar name: Required. Name to be checked. - :vartype name: str + :param type: Required. Type of the resource to check name availability. + :type type: str + :param name: Required. Name to be checked. + :type name: str """ _validation = { @@ -1989,12 +1670,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword type: Required. Type of the resource to check name availability. - :paramtype type: str - :keyword name: Required. Name to be checked. - :paramtype name: str - """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -2005,19 +1680,20 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring - Cloud Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Cloud service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :type service_runtime_subnet_id: str + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :type app_subnet_id: str + :param service_cidr: Azure Spring Cloud service reserved CIDR. + :type service_cidr: str + :param service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources of + :type service_runtime_network_resource_group: str + :param app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :vartype app_network_resource_group: str + :type app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_07_01.models.NetworkProfileOutboundIPs :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Cloud instance. @@ -2049,22 +1725,6 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Cloud service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Cloud Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :paramtype app_network_resource_group: str - """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -2096,8 +1756,6 @@ def __init__( self, **kwargs ): - """ - """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -2105,32 +1763,22 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - Variables are only populated by the server, and will be ignored when sending a request. - - :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.appplatform.v2020_07_01.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2020_07_01.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties """ - _validation = { - 'action_type': {'readonly': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -2145,23 +1793,10 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): - """ - :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.appplatform.v2020_07_01.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.OperationProperties - """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display - self.action_type = None self.origin = origin self.properties = properties @@ -2169,14 +1804,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :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 + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Resource of the operation. + :type resource: str + :param operation: Localized friendly name for the operation. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str """ _attribute_map = { @@ -2195,16 +1830,6 @@ def __init__( description: Optional[str] = None, **kwargs ): - """ - :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2215,8 +1840,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification """ _attribute_map = { @@ -2229,11 +1854,6 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2020_07_01.models.ServiceSpecification - """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2243,12 +1863,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar size_in_gb: Size of the persistent disk in GB. - :vartype size_in_gb: int + :param size_in_gb: Size of the persistent disk in GB. + :type size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :ivar mount_path: Mount path of the persistent disk. - :vartype mount_path: str + :param mount_path: Mount path of the persistent disk. + :type mount_path: str """ _validation = { @@ -2269,12 +1889,6 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): - """ - :keyword size_in_gb: Size of the persistent disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the persistent disk. - :paramtype mount_path: str - """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -2286,9 +1900,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + :param key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType + :type key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType """ _validation = { @@ -2305,11 +1919,6 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): - """ - :keyword key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.TestKeyType - """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2352,8 +1961,6 @@ def __init__( self, **kwargs ): - """ - """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2365,23 +1972,22 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :ivar resource_type: Gets the type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: Gets the name of SKU. - :vartype name: str - :ivar tier: Gets the tier of SKU. - :vartype tier: str - :ivar capacity: Gets the capacity of SKU. - :vartype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity - :ivar locations: Gets the set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Gets a list of locations and availability zones in those locations where + :param resource_type: Gets the type of resource the SKU applies to. + :type resource_type: str + :param name: Gets the name of SKU. + :type name: str + :param tier: Gets the tier of SKU. + :type tier: str + :param capacity: Gets the capacity of SKU. + :type capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity + :param locations: Gets the set of locations that the SKU is available. + :type locations: list[str] + :param location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :vartype location_info: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] - :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + :type location_info: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :vartype restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] + :type restrictions: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] """ _attribute_map = { @@ -2406,26 +2012,6 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): - """ - :keyword resource_type: Gets the type of resource the SKU applies to. - :paramtype resource_type: str - :keyword name: Gets the name of SKU. - :paramtype name: str - :keyword tier: Gets the tier of SKU. - :paramtype tier: str - :keyword capacity: Gets the capacity of SKU. - :paramtype capacity: ~azure.mgmt.appplatform.v2020_07_01.models.SkuCapacity - :keyword locations: Gets the set of locations that the SKU is available. - :paramtype locations: list[str] - :keyword location_info: Gets a list of locations and availability zones in those locations - where the SKU is available. - :paramtype location_info: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuLocationInfo] - :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :paramtype restrictions: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictions] - """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2439,10 +2025,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :ivar name: Gets an invariant to describe the feature. - :vartype name: str - :ivar value: Gets an invariant if the feature is measured by quantity. - :vartype value: str + :param name: Gets an invariant to describe the feature. + :type name: str + :param value: Gets an invariant if the feature is measured by quantity. + :type value: str """ _attribute_map = { @@ -2457,12 +2043,6 @@ def __init__( value: Optional[str] = None, **kwargs ): - """ - :keyword name: Gets an invariant to describe the feature. - :paramtype name: str - :keyword value: Gets an invariant if the feature is measured by quantity. - :paramtype value: str - """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2471,11 +2051,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -2490,13 +2070,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSku] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2505,12 +2078,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :ivar location: Gets location of the SKU. - :vartype location: str - :ivar zones: Gets list of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. - :vartype zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] + :param location: Gets location of the SKU. + :type location: str + :param zones: Gets list of availability zones where the SKU is supported. + :type zones: list[str] + :param zone_details: Gets details of capabilities available to a SKU in specific zones. + :type zone_details: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] """ _attribute_map = { @@ -2527,15 +2100,6 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): - """ - :keyword location: Gets location of the SKU. - :paramtype location: str - :keyword zones: Gets list of availability zones where the SKU is supported. - :paramtype zones: list[str] - :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. - :paramtype zone_details: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuZoneDetails] - """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2545,10 +2109,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :ivar locations: Gets locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: Gets list of availability zones where the SKU is restricted. - :vartype zones: list[str] + :param locations: Gets locations where the SKU is restricted. + :type locations: list[str] + :param zones: Gets list of availability zones where the SKU is restricted. + :type zones: list[str] """ _attribute_map = { @@ -2563,12 +2127,6 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): - """ - :keyword locations: Gets locations where the SKU is restricted. - :paramtype locations: list[str] - :keyword zones: Gets list of availability zones where the SKU is restricted. - :paramtype zones: list[str] - """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2577,20 +2135,19 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType - :ivar values: Gets the value of restrictions. If the restriction type is set to + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + :type values: list[str] + :param restriction_info: Gets the information about the restriction where the SKU cannot be used. - :vartype restriction_info: - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :type restriction_info: ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or + :type reason_code: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode """ @@ -2610,23 +2167,6 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsType - :keyword values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :paramtype values: list[str] - :keyword restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :paramtype restriction_info: - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuRestrictionsReasonCode - """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2637,12 +2177,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :ivar name: Gets the set of zones that the SKU is available in with the + :param name: Gets the set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + :type name: list[str] + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :vartype capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] + :type capabilities: list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] """ _attribute_map = { @@ -2657,15 +2197,6 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): - """ - :keyword name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :paramtype name: list[str] - :keyword capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :paramtype capabilities: - list[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCapabilities] - """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2674,10 +2205,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :ivar relative_path: Source relative path. - :vartype relative_path: str - :ivar upload_url: Upload URL. - :vartype upload_url: str + :param relative_path: Source relative path. + :type relative_path: str + :param upload_url: Upload URL. + :type upload_url: str """ _attribute_map = { @@ -2692,12 +2223,6 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2714,11 +2239,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] """ _validation = { @@ -2742,13 +2267,6 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2765,15 +2283,15 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the Service resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties + :param sku: Sku of the Service resource. + :type sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku """ _validation = { @@ -2801,17 +2319,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the Service resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_07_01.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2020_07_01.models.Sku - """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2820,11 +2327,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :ivar value: Collection of Service resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -2839,13 +2346,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2854,10 +2354,10 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] """ @@ -2873,14 +2373,6 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2020_07_01.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2020_07_01.models.MetricSpecification] - """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2889,12 +2381,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :ivar name: Name of the Sku. - :vartype name: str - :ivar tier: Tier of the Sku. - :vartype tier: str - :ivar capacity: Current capacity of the target resource. - :vartype capacity: int + :param name: Name of the Sku. + :type name: str + :param tier: Tier of the Sku. + :type tier: str + :param capacity: Current capacity of the target resource. + :type capacity: int """ _attribute_map = { @@ -2911,14 +2403,6 @@ def __init__( capacity: Optional[int] = None, **kwargs ): - """ - :keyword name: Name of the Sku. - :paramtype name: str - :keyword tier: Tier of the Sku. - :paramtype tier: str - :keyword capacity: Current capacity of the target resource. - :paramtype capacity: int - """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2930,15 +2414,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar minimum: Required. Gets or sets the minimum. - :vartype minimum: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar default: Gets or sets the default. - :vartype default: int - :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + :param minimum: Required. Gets or sets the minimum. + :type minimum: int + :param maximum: Gets or sets the maximum. + :type maximum: int + :param default: Gets or sets the default. + :type default: int + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType + :type scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType """ _validation = { @@ -2961,17 +2445,6 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): - """ - :keyword minimum: Required. Gets or sets the minimum. - :paramtype minimum: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword default: Gets or sets the default. - :paramtype default: int - :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_07_01.models.SkuScaleType - """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -2982,14 +2455,14 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values - include: "Java_8", "Java_11", "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :vartype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform - :ivar version: The detailed version (major.minor) of the platform. - :vartype version: str + :type platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform + :param version: The detailed version (major.minor) of the platform. + :type version: str """ _attribute_map = { @@ -3006,16 +2479,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :paramtype value: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :paramtype platform: str or ~azure.mgmt.appplatform.v2020_07_01.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -3025,10 +2488,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :ivar size_in_gb: Size of the temporary disk in GB. - :vartype size_in_gb: int - :ivar mount_path: Mount path of the temporary disk. - :vartype mount_path: str + :param size_in_gb: Size of the temporary disk in GB. + :type size_in_gb: int + :param mount_path: Mount path of the temporary disk. + :type mount_path: str """ _validation = { @@ -3047,12 +2510,6 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): - """ - :keyword size_in_gb: Size of the temporary disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the temporary disk. - :paramtype mount_path: str - """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -3061,16 +2518,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :ivar primary_key: Primary key. - :vartype primary_key: str - :ivar secondary_key: Secondary key. - :vartype secondary_key: str - :ivar primary_test_endpoint: Primary test endpoint. - :vartype primary_test_endpoint: str - :ivar secondary_test_endpoint: Secondary test endpoint. - :vartype secondary_test_endpoint: str - :ivar enabled: Indicates whether the test endpoint feature enabled or not. - :vartype enabled: bool + :param primary_key: Primary key. + :type primary_key: str + :param secondary_key: Secondary key. + :type secondary_key: str + :param primary_test_endpoint: Primary test endpoint. + :type primary_test_endpoint: str + :param secondary_test_endpoint: Secondary test endpoint. + :type secondary_test_endpoint: str + :param enabled: Indicates whether the test endpoint feature enabled or not. + :type enabled: bool """ _attribute_map = { @@ -3091,18 +2548,6 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): - """ - :keyword primary_key: Primary key. - :paramtype primary_key: str - :keyword secondary_key: Secondary key. - :paramtype secondary_key: str - :keyword primary_test_endpoint: Primary test endpoint. - :paramtype primary_test_endpoint: str - :keyword secondary_test_endpoint: Secondary test endpoint. - :paramtype secondary_test_endpoint: str - :keyword enabled: Indicates whether the test endpoint feature enabled or not. - :paramtype enabled: bool - """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -3114,17 +2559,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source". - :vartype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar version: Version of the source. - :vartype version: str - :ivar artifact_selector: Selector for the artifact to be used for the deployment for + :type type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str + :param version: Version of the source. + :type version: str + :param artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :vartype artifact_selector: str + :type artifact_selector: str """ _attribute_map = { @@ -3143,19 +2588,6 @@ def __init__( artifact_selector: Optional[str] = None, **kwargs ): - """ - :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source". - :paramtype type: str or ~azure.mgmt.appplatform.v2020_07_01.models.UserSourceType - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword version: Version of the source. - :paramtype version: str - :keyword artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :paramtype artifact_selector: str - """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py index 09cccf2f395..5be695c7364 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,319 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. @@ -342,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -360,7 +65,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -372,27 +77,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,47 +114,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -465,19 +177,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -491,19 +201,14 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -517,22 +222,28 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -542,42 +253,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -587,17 +302,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -609,17 +323,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -632,18 +343,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -653,47 +371,52 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -710,19 +433,17 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -736,19 +457,14 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_07_01.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -762,22 +478,28 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -787,17 +509,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.AppResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -806,48 +528,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -856,11 +575,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -869,20 +584,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace def get_resource_upload_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -902,26 +616,29 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -934,19 +651,17 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace def validate_domain( self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -968,30 +683,34 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1004,6 +723,4 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py index ef560219299..4d01d1bab12 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_07_01.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.BindingResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py index 2eff878a63c..f60d181ac48 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,185 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. @@ -208,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -235,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -327,19 +172,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> LROPoller["_models.CertificateResource"]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -353,20 +196,14 @@ def begin_create_or_update( :type certificate_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -380,22 +217,28 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -405,42 +248,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -450,17 +297,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -472,17 +318,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -495,18 +338,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -516,17 +366,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.CertificateResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -535,48 +385,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -585,11 +432,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -598,8 +441,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py index 354d13f4ec3..c4dfb55f98b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,194 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -217,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -241,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -327,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -350,20 +183,14 @@ def begin_update_put( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -376,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -401,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -456,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -479,20 +314,14 @@ def begin_update_patch( :type config_server_resource: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -505,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -530,45 +364,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -585,18 +424,16 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace def begin_validate( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -608,20 +445,14 @@ def begin_validate( :type config_server_settings: ~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -634,22 +465,27 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -659,6 +495,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py index e1ab08c8fc8..4b7051f56c7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py index 0685c35e7aa..7c9649aea65 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,445 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_cluster_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restart_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_log_file_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -468,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -498,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -531,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -593,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -622,20 +205,14 @@ def begin_create_or_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -650,22 +227,29 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -675,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -722,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -747,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -771,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -792,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -851,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -880,20 +475,14 @@ def begin_update( :type deployment_resource: ~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -908,22 +497,29 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -933,19 +529,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -955,55 +551,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1012,11 +604,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1025,20 +613,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1046,53 +633,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1101,11 +685,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1114,46 +694,49 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1163,18 +746,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1188,17 +770,14 @@ def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1212,18 +791,26 @@ def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1233,44 +820,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1280,18 +871,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1305,17 +895,14 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1329,18 +916,26 @@ def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1350,44 +945,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1397,18 +996,17 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements + def begin_restart( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1422,17 +1020,14 @@ def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1446,18 +1041,26 @@ def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1467,19 +1070,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace def get_log_file_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1501,27 +1104,30 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1536,6 +1142,4 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py index 1b145d7f6ad..417872e32c6 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,150 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -173,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -197,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -283,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -303,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -333,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -358,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -413,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -433,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -463,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -488,6 +364,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py index 17678c09ffc..8805b707216 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,50 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. @@ -73,49 +45,47 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +94,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,8 +103,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py index 96087c60009..0833e317039 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,49 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_runtime_versions_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -72,11 +44,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list_runtime_versions( self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -89,22 +61,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,6 +89,4 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py index 011cf1eb7f0..6e2ae13f774 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,447 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_test_keys_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_test_key_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_disable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_enable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. @@ -470,13 +47,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -494,25 +71,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -525,45 +105,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -583,18 +166,16 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -606,20 +187,14 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -632,22 +207,27 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,40 +237,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -700,16 +284,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -719,17 +302,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -741,18 +321,24 @@ def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -762,45 +348,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -817,18 +408,16 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -840,20 +429,14 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -866,22 +449,27 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -891,17 +479,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace def list_test_keys( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -919,25 +507,28 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -950,18 +541,16 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace def regenerate_test_key( self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -970,8 +559,7 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_07_01.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.TestKeys @@ -982,29 +570,33 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1017,17 +609,15 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + def disable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1045,25 +635,28 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1073,16 +666,15 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace def enable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1100,25 +692,28 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-07-01") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1131,24 +726,21 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace def check_name_availability( self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_07_01.models.NameAvailability @@ -1159,28 +751,32 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-07-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1193,55 +789,53 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1250,11 +844,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1263,18 +853,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1282,44 +871,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1328,11 +916,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1341,8 +925,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py index 3f9b1adf699..4e05d050f70 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,56 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. @@ -79,52 +45,51 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.ResourceSkuCollection"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_07_01.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-07-01") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-07-01" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,11 +98,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -146,8 +107,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py index 41ec6d71ff7..d2ddf950056 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/__init__.py @@ -12,7 +12,8 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py index c0648f257f3..3e902325d70 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_app_platform_management_client.py @@ -6,119 +6,124 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from . import models + -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2020_11_01_preview.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2020_11_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2020_11_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2020_11_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2020_11_01_preview.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2020_11_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2020_11_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2020_11_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2020_11_01_preview.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2020_11_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_11_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2020_11_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2020_11_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - + self._deserialize = Deserializer(client_models) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse + :rtype: ~azure.core.pipeline.transport.HttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py index c42f5779459..9678a78ee77 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_configuration.py @@ -6,20 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any + from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,31 +29,26 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2020-11-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -71,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py index 44ce4a5043f..39f10548873 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/__init__.py @@ -8,8 +8,3 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py index 89198b7ef24..5ca00dfff68 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_app_platform_management_client.py @@ -6,119 +6,120 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .. import models + + +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2020_11_01_preview.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - + self._deserialize = Deserializer(client_models) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py index ceda2426d5f..89cd6bbbc8e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,12 +27,8 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-11-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -41,17 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2020-11-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -70,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py index 070f860b6e5..19ae5271884 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,7 +60,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,27 +72,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +109,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _create_or_update_initial( self, @@ -127,30 +124,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -170,11 +171,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -196,20 +194,14 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -223,22 +215,28 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,11 +246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -264,26 +262,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -293,11 +294,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -315,17 +314,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,18 +334,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,9 +362,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _update_initial( self, @@ -376,30 +379,34 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -416,11 +423,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,20 +446,14 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -469,22 +467,28 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,11 +498,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace def list( self, resource_group_name: str, @@ -513,48 +516,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,11 +563,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,13 +572,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -609,26 +603,29 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,11 +638,8 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -664,8 +658,7 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult @@ -676,30 +669,34 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,6 +709,4 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py index 76b37e85fda..77f8b3f7fe8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py index 623d65bb8da..71b2ff176be 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,11 +166,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,24 +186,17 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -220,22 +210,28 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -245,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -261,26 +257,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -290,11 +289,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -312,17 +309,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -335,18 +329,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -356,11 +357,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -375,48 +375,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,11 +422,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,8 +431,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py index cde7409fb45..175fc48484d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,9 +355,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _validate_initial( self, @@ -376,29 +371,33 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -415,11 +414,8 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -435,24 +431,17 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,22 +454,27 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,6 +484,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py index 342334a95ff..40546c17e4f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py index 8d604047680..1428ce78df9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,24 +195,17 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -230,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -272,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -327,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -351,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _update_initial( self, @@ -390,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -431,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -457,24 +461,17 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -489,22 +486,29 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -536,55 +539,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -593,11 +592,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,13 +601,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -627,53 +620,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,11 +672,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -695,13 +681,12 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -714,27 +699,30 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -744,11 +732,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -769,17 +755,14 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -793,18 +776,26 @@ async def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -814,11 +805,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -831,27 +822,30 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -861,11 +855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -886,17 +878,14 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -910,18 +899,26 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -931,11 +928,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, service_name: str, @@ -948,27 +945,30 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,11 +978,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements + async def begin_restart( self, resource_group_name: str, service_name: str, @@ -1003,17 +1001,14 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1027,18 +1022,26 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1048,11 +1051,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1082,27 +1084,30 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1117,6 +1122,4 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py index 16602bed5ec..6ee477698c7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,6 +355,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py index bf7f85fc01b..4353874d448 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -53,40 +49,38 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,11 +89,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,8 +98,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py index 63a48bbde4d..a4d56940113 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,18 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._runtime_versions_operations import build_list_runtime_versions_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -60,22 +56,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,6 +84,4 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py index 21ec27a3598..b525473b065 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -71,25 +66,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,9 +100,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _create_or_update_initial( self, @@ -118,29 +114,33 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,11 +160,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -183,20 +180,14 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -209,22 +200,27 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -234,11 +230,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -249,25 +245,28 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -277,11 +276,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -296,17 +293,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -318,18 +312,24 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _update_initial( self, @@ -355,29 +355,33 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -394,11 +398,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,20 +418,14 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -443,22 +438,27 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,11 +468,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -496,25 +495,28 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -527,11 +529,8 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -547,8 +546,7 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys @@ -559,29 +557,33 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -594,12 +596,9 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + async def disable_test_endpoint( self, resource_group_name: str, service_name: str, @@ -622,25 +621,28 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -650,10 +652,8 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,25 +677,28 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -708,11 +711,8 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,8 +724,7 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability @@ -736,28 +735,32 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -770,11 +773,8 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,42 +783,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -827,11 +827,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -840,13 +836,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -859,44 +853,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,11 +898,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -918,8 +907,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py index 6c5411a3e6d..7fe9f418d62 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -52,44 +48,43 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,11 +93,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,8 +102,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py index 97492b478ee..6ff92bf6005 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/__init__.py @@ -6,79 +6,148 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import AvailableOperations -from ._models_py3 import AvailableRuntimeVersions -from ._models_py3 import BindingResource -from ._models_py3 import BindingResourceCollection -from ._models_py3 import BindingResourceProperties -from ._models_py3 import CertificateProperties -from ._models_py3 import CertificateResource -from ._models_py3 import CertificateResourceCollection -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterResourceProperties -from ._models_py3 import ConfigServerGitProperty -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerSettings -from ._models_py3 import ConfigServerSettingsErrorRecord -from ._models_py3 import ConfigServerSettingsValidateResult -from ._models_py3 import CustomDomainProperties -from ._models_py3 import CustomDomainResource -from ._models_py3 import CustomDomainResourceCollection -from ._models_py3 import CustomDomainValidatePayload -from ._models_py3 import CustomDomainValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import Error -from ._models_py3 import GitPatternRepository -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import MonitoringSettingProperties -from ._models_py3 import MonitoringSettingResource -from ._models_py3 import NameAvailability -from ._models_py3 import NameAvailabilityParameters -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileOutboundIPs -from ._models_py3 import OperationDetail -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationProperties -from ._models_py3 import PersistentDisk -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RequiredTraffic -from ._models_py3 import Resource -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuCapabilities -from ._models_py3 import ResourceSkuCollection -from ._models_py3 import ResourceSkuLocationInfo -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import ResourceSkuZoneDetails -from ._models_py3 import ResourceUploadDefinition -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceList -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import TemporaryDisk -from ._models_py3 import TestKeys -from ._models_py3 import TrackedResource -from ._models_py3 import UserSourceInfo - +try: + from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection + from ._models_py3 import AppResourceProperties + from ._models_py3 import ApplicationInsightsAgentVersions + from ._models_py3 import AvailableOperations + from ._models_py3 import AvailableRuntimeVersions + from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection + from ._models_py3 import BindingResourceProperties + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody + from ._models_py3 import ClusterResourceProperties + from ._models_py3 import ConfigServerGitProperty + from ._models_py3 import ConfigServerProperties + from ._models_py3 import ConfigServerResource + from ._models_py3 import ConfigServerSettings + from ._models_py3 import ConfigServerSettingsErrorRecord + from ._models_py3 import ConfigServerSettingsValidateResult + from ._models_py3 import CustomDomainProperties + from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection + from ._models_py3 import CustomDomainValidatePayload + from ._models_py3 import CustomDomainValidateResult + from ._models_py3 import DeploymentInstance + from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection + from ._models_py3 import DeploymentResourceProperties + from ._models_py3 import DeploymentSettings + from ._models_py3 import Error + from ._models_py3 import GitPatternRepository + from ._models_py3 import LogFileUrlResponse + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentityProperties + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification + from ._models_py3 import MonitoringSettingProperties + from ._models_py3 import MonitoringSettingResource + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters + from ._models_py3 import NetworkProfile + from ._models_py3 import NetworkProfileOutboundIPs + from ._models_py3 import OperationDetail + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationProperties + from ._models_py3 import PersistentDisk + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateTestKeyRequestPayload + from ._models_py3 import RequiredTraffic + from ._models_py3 import Resource + from ._models_py3 import ResourceSku + from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection + from ._models_py3 import ResourceSkuLocationInfo + from ._models_py3 import ResourceSkuRestrictionInfo + from ._models_py3 import ResourceSkuRestrictions + from ._models_py3 import ResourceSkuZoneDetails + from ._models_py3 import ResourceUploadDefinition + from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import SkuCapacity + from ._models_py3 import SupportedRuntimeVersion + from ._models_py3 import TemporaryDisk + from ._models_py3 import TestKeys + from ._models_py3 import TrackedResource + from ._models_py3 import UserSourceInfo +except (SyntaxError, ImportError): + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import ApplicationInsightsAgentVersions # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( - ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -167,7 +236,6 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', - 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py index 48326092115..5ac8dede62c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_app_platform_management_client_enums.py @@ -6,18 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) - INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -26,7 +35,7 @@ class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -36,7 +45,7 @@ class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -45,7 +54,7 @@ class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -57,7 +66,7 @@ class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -66,7 +75,7 @@ class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -75,7 +84,7 @@ class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -89,7 +98,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -97,14 +106,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -112,7 +121,7 @@ class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -120,14 +129,14 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -135,21 +144,21 @@ class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py index b933174dc56..e8b893255fd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/models/_models_py3.py @@ -34,8 +34,6 @@ def __init__( self, **kwargs ): - """ - """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -69,8 +67,6 @@ def __init__( self, **kwargs ): - """ - """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -106,8 +102,6 @@ def __init__( self, **kwargs ): - """ - """ super(ProxyResource, self).__init__(**kwargs) @@ -122,12 +116,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties - :ivar location: The GEO location of the application, always the same with its parent resource. - :vartype location: str + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. + :type location: str """ _validation = { @@ -153,16 +147,6 @@ def __init__( location: Optional[str] = None, **kwargs ): - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -172,11 +156,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of App resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -191,13 +175,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -208,28 +185,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar public: Indicates whether the App exposes public endpoint. - :vartype public: bool + :param public: Indicates whether the App exposes public endpoint. + :type public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceProvisioningState - :ivar active_deployment_name: Name of the active deployment of the App. - :vartype active_deployment_name: str - :ivar fqdn: Fully qualified dns Name. - :vartype fqdn: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool + :param active_deployment_name: Name of the active deployment of the App. + :type active_deployment_name: str + :param fqdn: Fully qualified dns Name. + :type fqdn: str + :param https_only: Indicate if only https is allowed. + :type https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :ivar temporary_disk: Temporary disk settings. - :vartype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk - :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :vartype enable_end_to_end_tls: bool + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk + :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :type enable_end_to_end_tls: bool """ _validation = { @@ -263,22 +240,6 @@ def __init__( enable_end_to_end_tls: Optional[bool] = False, **kwargs ): - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword active_deployment_name: Name of the active deployment of the App. - :paramtype active_deployment_name: str - :keyword fqdn: Fully qualified dns Name. - :paramtype fqdn: str - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword temporary_disk: Temporary disk settings. - :paramtype temporary_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2020_11_01_preview.models.PersistentDisk - :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :paramtype enable_end_to_end_tls: bool - """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -295,11 +256,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -314,13 +275,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDetail] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -348,8 +302,6 @@ def __init__( self, **kwargs ): - """ - """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -365,9 +317,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties """ _validation = { @@ -389,11 +340,6 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceProperties - """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -401,11 +347,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :ivar value: Collection of Binding resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -420,13 +366,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -441,12 +380,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :ivar resource_id: The Azure resource id of the bound resource. - :vartype resource_id: str - :ivar key: The key of the bound resource. - :vartype key: str - :ivar binding_parameters: Binding parameters of the Binding resource. - :vartype binding_parameters: dict[str, any] + :param resource_id: The Azure resource id of the bound resource. + :type resource_id: str + :param key: The key of the bound resource. + :type key: str + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -483,14 +422,6 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): - """ - :keyword resource_id: The Azure resource id of the bound resource. - :paramtype resource_id: str - :keyword key: The key of the bound resource. - :paramtype key: str - :keyword binding_parameters: Binding parameters of the Binding resource. - :paramtype binding_parameters: dict[str, any] - """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -511,12 +442,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :ivar vault_uri: Required. The vault uri of user key vault. - :vartype vault_uri: str - :ivar key_vault_cert_name: Required. The certificate name of key vault. - :vartype key_vault_cert_name: str - :ivar cert_version: The certificate version of key vault. - :vartype cert_version: str + :param vault_uri: Required. The vault uri of user key vault. + :type vault_uri: str + :param key_vault_cert_name: Required. The certificate name of key vault. + :type key_vault_cert_name: str + :param cert_version: The certificate version of key vault. + :type cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -564,14 +495,6 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): - """ - :keyword vault_uri: Required. The vault uri of user key vault. - :paramtype vault_uri: str - :keyword key_vault_cert_name: Required. The certificate name of key vault. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -596,8 +519,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties """ _validation = { @@ -619,10 +542,6 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateProperties - """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -630,10 +549,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :ivar value: The certificate resources list. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :ivar next_link: The link to next page of certificate list. - :vartype next_link: str + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { @@ -648,12 +567,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -662,17 +575,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + :param code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in + :type message: str + :param target: The target of the particular error. For example, the name of the property in error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -691,19 +604,6 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CloudErrorBody] - """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -721,8 +621,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -748,10 +648,6 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfile - """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -764,27 +660,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar repositories: Repositories of git. - :vartype repositories: + :param repositories: Repositories of git. + :type repositories: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -819,29 +715,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.GitPatternRepository] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -864,10 +737,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :param error: Error when apply config server settings. + :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :param config_server: Settings of config server. + :type config_server: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings """ _validation = { @@ -887,13 +760,6 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings - """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -911,8 +777,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties """ _validation = { @@ -934,11 +800,6 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerProperties - """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -946,9 +807,8 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty + :param git_property: Property of git environment. + :type git_property: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -961,11 +821,6 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerGitProperty - """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -973,12 +828,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :ivar name: The name of the config server settings error record. - :vartype name: str - :ivar uri: The uri of the config server settings error record. - :vartype uri: str - :ivar messages: The detail error messages of the record. - :vartype messages: list[str] + :param name: The name of the config server settings error record. + :type name: str + :param uri: The uri of the config server settings error record. + :type uri: str + :param messages: The detail error messages of the record. + :type messages: list[str] """ _attribute_map = { @@ -995,14 +850,6 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): - """ - :keyword name: The name of the config server settings error record. - :paramtype name: str - :keyword uri: The uri of the config server settings error record. - :paramtype uri: str - :keyword messages: The detail error messages of the record. - :paramtype messages: list[str] - """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -1012,10 +859,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :ivar is_valid: Indicate if the config server settings are valid. - :vartype is_valid: bool - :ivar details: The detail validation results. - :vartype details: + :param is_valid: Indicate if the config server settings are valid. + :type is_valid: bool + :param details: The detail validation results. + :type details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -1031,13 +878,6 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): - """ - :keyword is_valid: Indicate if the config server settings are valid. - :paramtype is_valid: bool - :keyword details: The detail validation results. - :paramtype details: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsErrorRecord] - """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -1048,12 +888,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str + :param thumbprint: The thumbprint of bound certificate. + :type thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :ivar cert_name: The bound certificate name of domain. - :vartype cert_name: str + :param cert_name: The bound certificate name of domain. + :type cert_name: str """ _validation = { @@ -1073,12 +913,6 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -1096,8 +930,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties + :param properties: Properties of the custom domain resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties """ _validation = { @@ -1119,11 +953,6 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainProperties - """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -1131,10 +960,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :ivar value: The custom domain resources list. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :ivar next_link: The link to next page of custom domain list. - :vartype next_link: str + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str """ _attribute_map = { @@ -1149,12 +978,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1165,8 +988,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name to be validated. - :vartype name: str + :param name: Required. Name to be validated. + :type name: str """ _validation = { @@ -1183,10 +1006,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword name: Required. Name to be validated. - :paramtype name: str - """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1194,10 +1013,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :ivar is_valid: Indicates if domain name is valid. - :vartype is_valid: bool - :ivar message: Message of why domain name is invalid. - :vartype message: str + :param is_valid: Indicates if domain name is valid. + :type is_valid: bool + :param message: Message of why domain name is invalid. + :type message: str """ _attribute_map = { @@ -1212,12 +1031,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword is_valid: Indicates if domain name is valid. - :paramtype is_valid: bool - :keyword message: Message of why domain name is invalid. - :paramtype message: str - """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1260,8 +1073,6 @@ def __init__( self, **kwargs ): - """ - """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1281,11 +1092,11 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Deployment resource. - :vartype properties: + :param properties: Properties of the Deployment resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + :param sku: Sku of the Deployment resource. + :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -1309,13 +1120,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku - """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1324,11 +1128,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of Deployment resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1343,13 +1147,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1360,12 +1157,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar source: Uploaded source information of the deployment. - :vartype source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo + :param source: Uploaded source information of the deployment. + :type source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: + :param deployment_settings: Deployment settings of the Deployment. + :type deployment_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -1410,13 +1207,6 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentSettings - """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1431,21 +1221,20 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :ivar cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :vartype cpu: int - :ivar memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard + :param cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). + :type cpu: int + :param memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), standard tier should be in range (1, 8). - :vartype memory_in_gb: int - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. - :vartype net_core_main_entry_path: str - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :type memory_in_gb: int + :param jvm_options: JVM parameter. + :type jvm_options: str + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. + :type net_core_main_entry_path: str + :param environment_variables: Collection of environment variables. + :type environment_variables: dict[str, str] + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :vartype runtime_version: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion + :type runtime_version: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1468,23 +1257,6 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): - """ - :keyword cpu: Required CPU, basic tier should be 1, standard tier should be in range (1, 4). - :paramtype cpu: int - :keyword memory_in_gb: Required Memory size in GB, basic tier should be in range (1, 2), - standard tier should be in range (1, 8). - :paramtype memory_in_gb: int - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. - :paramtype net_core_main_entry_path: str - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", - "NetCore_31". Default value: "Java_8". - :paramtype runtime_version: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RuntimeVersion - """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1497,10 +1269,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :ivar code: The code of error. - :vartype code: str - :ivar message: The message of error. - :vartype message: str + :param code: The code of error. + :type code: str + :param message: The message of error. + :type message: str """ _attribute_map = { @@ -1515,12 +1287,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1531,28 +1297,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param name: Required. Name of the repository. + :type name: str + :param pattern: Collection of pattern of the repository. + :type pattern: list[str] + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -1590,30 +1356,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1633,8 +1375,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar url: Required. URL of the log file. - :vartype url: str + :param url: Required. URL of the log file. + :type url: str """ _validation = { @@ -1651,10 +1393,6 @@ def __init__( url: str, **kwargs ): - """ - :keyword url: Required. URL of the log file. - :paramtype url: str - """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1662,12 +1400,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str """ _attribute_map = { @@ -1684,14 +1422,6 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1701,13 +1431,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id. - :vartype principal_id: str - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str + :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. + :type principal_id: str + :param tenant_id: Tenant Id. + :type tenant_id: str """ _attribute_map = { @@ -1724,15 +1454,6 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): - """ - :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1742,13 +1463,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :param name: Name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :vartype to_be_exported_for_shoebox: bool + :type to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1765,15 +1486,6 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :paramtype to_be_exported_for_shoebox: bool - """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1783,31 +1495,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: Unit that makes sense for the metric. + :type unit: str + :param category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :type category: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :type aggregation_type: str + :param supported_aggregation_types: Supported aggregation types. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: Supported time grain types. + :type supported_time_grain_types: list[str] + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] - :ivar source_mdm_namespace: Name of the MDM namespace. Optional. - :vartype source_mdm_namespace: str + :type fill_gap_with_zero: bool + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] + :param source_mdm_namespace: Name of the MDM namespace. Optional. + :type source_mdm_namespace: str """ _attribute_map = { @@ -1840,33 +1552,6 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1890,20 +1575,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated - since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate - if monitoringSettings enabled or not. - :vartype trace_enabled: bool - :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or - whitespace include empty will disable monitoringSettings. - :vartype app_insights_instrumentation_key: str - :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :param error: Error when apply Monitoring Setting changes. + :type error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :type trace_enabled: bool + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :type app_insights_instrumentation_key: str + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :vartype app_insights_sampling_rate: float - :ivar app_insights_agent_versions: Indicates the versions of application insight agent. - :vartype app_insights_agent_versions: + :type app_insights_sampling_rate: float + :param app_insights_agent_versions: Indicates the versions of application insight agent. + :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions """ @@ -1931,23 +1616,6 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Error - :keyword trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :paramtype trace_enabled: bool - :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :paramtype app_insights_instrumentation_key: str - :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :paramtype app_insights_sampling_rate: float - :keyword app_insights_agent_versions: Indicates the versions of application insight agent. - :paramtype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ApplicationInsightsAgentVersions - """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1968,8 +1636,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: + :param properties: Properties of the Monitoring Setting resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties """ @@ -1992,11 +1660,6 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingProperties - """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -2004,12 +1667,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: Reason why the name is not available. - :vartype reason: str - :ivar message: Message why the name is not available. - :vartype message: str + :param name_available: Indicates whether the name is available. + :type name_available: bool + :param reason: Reason why the name is not available. + :type reason: str + :param message: Message why the name is not available. + :type message: str """ _attribute_map = { @@ -2026,14 +1689,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword name_available: Indicates whether the name is available. - :paramtype name_available: bool - :keyword reason: Reason why the name is not available. - :paramtype reason: str - :keyword message: Message why the name is not available. - :paramtype message: str - """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2045,10 +1700,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the resource to check name availability. - :vartype type: str - :ivar name: Required. Name to be checked. - :vartype name: str + :param type: Required. Type of the resource to check name availability. + :type type: str + :param name: Required. Name to be checked. + :type name: str """ _validation = { @@ -2068,12 +1723,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword type: Required. Type of the resource to check name availability. - :paramtype type: str - :keyword name: Required. Name to be checked. - :paramtype name: str - """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -2084,19 +1733,20 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring - Cloud Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Cloud service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :type service_runtime_subnet_id: str + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :type app_subnet_id: str + :param service_cidr: Azure Spring Cloud service reserved CIDR. + :type service_cidr: str + :param service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources of + :type service_runtime_network_resource_group: str + :param app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :vartype app_network_resource_group: str + :type app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NetworkProfileOutboundIPs @@ -2130,22 +1780,6 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Cloud service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Cloud Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :paramtype app_network_resource_group: str - """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -2177,8 +1811,6 @@ def __init__( self, **kwargs ): - """ - """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -2186,32 +1818,22 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - Variables are only populated by the server, and will be ignored when sending a request. - - :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.appplatform.v2020_11_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties """ - _validation = { - 'action_type': {'readonly': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -2226,23 +1848,10 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): - """ - :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.appplatform.v2020_11_01_preview.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.OperationProperties - """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display - self.action_type = None self.origin = origin self.properties = properties @@ -2250,14 +1859,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :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 + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Resource of the operation. + :type resource: str + :param operation: Localized friendly name for the operation. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str """ _attribute_map = { @@ -2276,16 +1885,6 @@ def __init__( description: Optional[str] = None, **kwargs ): - """ - :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2296,8 +1895,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification """ @@ -2311,11 +1910,6 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceSpecification - """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2325,12 +1919,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar size_in_gb: Size of the persistent disk in GB. - :vartype size_in_gb: int + :param size_in_gb: Size of the persistent disk in GB. + :type size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :ivar mount_path: Mount path of the persistent disk. - :vartype mount_path: str + :param mount_path: Mount path of the persistent disk. + :type mount_path: str """ _validation = { @@ -2351,12 +1945,6 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): - """ - :keyword size_in_gb: Size of the persistent disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the persistent disk. - :paramtype mount_path: str - """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -2368,9 +1956,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + :param key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType + :type key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType """ _validation = { @@ -2387,11 +1975,6 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): - """ - :keyword key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeyType - """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2434,8 +2017,6 @@ def __init__( self, **kwargs ): - """ - """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2447,23 +2028,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :ivar resource_type: Gets the type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: Gets the name of SKU. - :vartype name: str - :ivar tier: Gets the tier of SKU. - :vartype tier: str - :ivar capacity: Gets the capacity of SKU. - :vartype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity - :ivar locations: Gets the set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Gets a list of locations and availability zones in those locations where + :param resource_type: Gets the type of resource the SKU applies to. + :type resource_type: str + :param name: Gets the name of SKU. + :type name: str + :param tier: Gets the tier of SKU. + :type tier: str + :param capacity: Gets the capacity of SKU. + :type capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity + :param locations: Gets the set of locations that the SKU is available. + :type locations: list[str] + :param location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :vartype location_info: + :type location_info: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] - :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :vartype restrictions: + :type restrictions: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] """ @@ -2489,26 +2070,6 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): - """ - :keyword resource_type: Gets the type of resource the SKU applies to. - :paramtype resource_type: str - :keyword name: Gets the name of SKU. - :paramtype name: str - :keyword tier: Gets the tier of SKU. - :paramtype tier: str - :keyword capacity: Gets the capacity of SKU. - :paramtype capacity: ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuCapacity - :keyword locations: Gets the set of locations that the SKU is available. - :paramtype locations: list[str] - :keyword location_info: Gets a list of locations and availability zones in those locations - where the SKU is available. - :paramtype location_info: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuLocationInfo] - :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :paramtype restrictions: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictions] - """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2522,10 +2083,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :ivar name: Gets an invariant to describe the feature. - :vartype name: str - :ivar value: Gets an invariant if the feature is measured by quantity. - :vartype value: str + :param name: Gets an invariant to describe the feature. + :type name: str + :param value: Gets an invariant if the feature is measured by quantity. + :type value: str """ _attribute_map = { @@ -2540,12 +2101,6 @@ def __init__( value: Optional[str] = None, **kwargs ): - """ - :keyword name: Gets an invariant to describe the feature. - :paramtype name: str - :keyword value: Gets an invariant if the feature is measured by quantity. - :paramtype value: str - """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2554,11 +2109,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -2573,13 +2128,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSku] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2588,12 +2136,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :ivar location: Gets location of the SKU. - :vartype location: str - :ivar zones: Gets list of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. - :vartype zone_details: + :param location: Gets location of the SKU. + :type location: str + :param zones: Gets list of availability zones where the SKU is supported. + :type zones: list[str] + :param zone_details: Gets details of capabilities available to a SKU in specific zones. + :type zone_details: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] """ @@ -2611,15 +2159,6 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): - """ - :keyword location: Gets location of the SKU. - :paramtype location: str - :keyword zones: Gets list of availability zones where the SKU is supported. - :paramtype zones: list[str] - :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. - :paramtype zone_details: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuZoneDetails] - """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2629,10 +2168,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :ivar locations: Gets locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: Gets list of availability zones where the SKU is restricted. - :vartype zones: list[str] + :param locations: Gets locations where the SKU is restricted. + :type locations: list[str] + :param zones: Gets list of availability zones where the SKU is restricted. + :type zones: list[str] """ _attribute_map = { @@ -2647,12 +2186,6 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): - """ - :keyword locations: Gets locations where the SKU is restricted. - :paramtype locations: list[str] - :keyword zones: Gets list of availability zones where the SKU is restricted. - :paramtype zones: list[str] - """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2661,21 +2194,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :vartype type: str or + :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType - :ivar values: Gets the value of restrictions. If the restriction type is set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + :type values: list[str] + :param restriction_info: Gets the information about the restriction where the SKU cannot be used. - :vartype restriction_info: + :type restriction_info: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or + :type reason_code: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2695,24 +2228,6 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsType - :keyword values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :paramtype values: list[str] - :keyword restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :paramtype restriction_info: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuRestrictionsReasonCode - """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2723,12 +2238,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :ivar name: Gets the set of zones that the SKU is available in with the + :param name: Gets the set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + :type name: list[str] + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :vartype capabilities: + :type capabilities: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] """ @@ -2744,15 +2259,6 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): - """ - :keyword name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :paramtype name: list[str] - :keyword capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :paramtype capabilities: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCapabilities] - """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2761,10 +2267,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :ivar relative_path: Source relative path. - :vartype relative_path: str - :ivar upload_url: Upload URL. - :vartype upload_url: str + :param relative_path: Source relative path. + :type relative_path: str + :param upload_url: Upload URL. + :type upload_url: str """ _attribute_map = { @@ -2779,12 +2285,6 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2801,11 +2301,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] """ _validation = { @@ -2829,13 +2329,6 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2852,16 +2345,15 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the Service resource. - :vartype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. + :type sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku """ _validation = { @@ -2889,18 +2381,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the Service resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2020_11_01_preview.models.Sku - """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -2909,11 +2389,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :ivar value: Collection of Service resources. - :vartype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -2928,13 +2408,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2943,11 +2416,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] """ @@ -2963,14 +2436,6 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2020_11_01_preview.models.MetricSpecification] - """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2979,12 +2444,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :ivar name: Name of the Sku. - :vartype name: str - :ivar tier: Tier of the Sku. - :vartype tier: str - :ivar capacity: Current capacity of the target resource. - :vartype capacity: int + :param name: Name of the Sku. + :type name: str + :param tier: Tier of the Sku. + :type tier: str + :param capacity: Current capacity of the target resource. + :type capacity: int """ _attribute_map = { @@ -3001,14 +2466,6 @@ def __init__( capacity: Optional[int] = None, **kwargs ): - """ - :keyword name: Name of the Sku. - :paramtype name: str - :keyword tier: Tier of the Sku. - :paramtype tier: str - :keyword capacity: Current capacity of the target resource. - :paramtype capacity: int - """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -3020,15 +2477,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar minimum: Required. Gets or sets the minimum. - :vartype minimum: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar default: Gets or sets the default. - :vartype default: int - :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + :param minimum: Required. Gets or sets the minimum. + :type minimum: int + :param maximum: Gets or sets the maximum. + :type maximum: int + :param default: Gets or sets the default. + :type default: int + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType + :type scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType """ _validation = { @@ -3051,17 +2508,6 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): - """ - :keyword minimum: Required. Gets or sets the minimum. - :paramtype minimum: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword default: Gets or sets the default. - :paramtype default: int - :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SkuScaleType - """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -3072,15 +2518,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values - include: "Java_8", "Java_11", "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :vartype platform: str or + :type platform: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform - :ivar version: The detailed version (major.minor) of the platform. - :vartype version: str + :param version: The detailed version (major.minor) of the platform. + :type version: str """ _attribute_map = { @@ -3097,18 +2543,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2020_11_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -3118,10 +2552,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :ivar size_in_gb: Size of the temporary disk in GB. - :vartype size_in_gb: int - :ivar mount_path: Mount path of the temporary disk. - :vartype mount_path: str + :param size_in_gb: Size of the temporary disk in GB. + :type size_in_gb: int + :param mount_path: Mount path of the temporary disk. + :type mount_path: str """ _validation = { @@ -3140,12 +2574,6 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): - """ - :keyword size_in_gb: Size of the temporary disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the temporary disk. - :paramtype mount_path: str - """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -3154,16 +2582,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :ivar primary_key: Primary key. - :vartype primary_key: str - :ivar secondary_key: Secondary key. - :vartype secondary_key: str - :ivar primary_test_endpoint: Primary test endpoint. - :vartype primary_test_endpoint: str - :ivar secondary_test_endpoint: Secondary test endpoint. - :vartype secondary_test_endpoint: str - :ivar enabled: Indicates whether the test endpoint feature enabled or not. - :vartype enabled: bool + :param primary_key: Primary key. + :type primary_key: str + :param secondary_key: Secondary key. + :type secondary_key: str + :param primary_test_endpoint: Primary test endpoint. + :type primary_test_endpoint: str + :param secondary_test_endpoint: Secondary test endpoint. + :type secondary_test_endpoint: str + :param enabled: Indicates whether the test endpoint feature enabled or not. + :type enabled: bool """ _attribute_map = { @@ -3184,18 +2612,6 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): - """ - :keyword primary_key: Primary key. - :paramtype primary_key: str - :keyword secondary_key: Secondary key. - :paramtype secondary_key: str - :keyword primary_test_endpoint: Primary test endpoint. - :paramtype primary_test_endpoint: str - :keyword secondary_test_endpoint: Secondary test endpoint. - :paramtype secondary_test_endpoint: str - :keyword enabled: Indicates whether the test endpoint feature enabled or not. - :paramtype enabled: bool - """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -3207,17 +2623,17 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source". - :vartype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar version: Version of the source. - :vartype version: str - :ivar artifact_selector: Selector for the artifact to be used for the deployment for + :type type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str + :param version: Version of the source. + :type version: str + :param artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :vartype artifact_selector: str + :type artifact_selector: str """ _attribute_map = { @@ -3236,19 +2652,6 @@ def __init__( artifact_selector: Optional[str] = None, **kwargs ): - """ - :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source". - :paramtype type: str or ~azure.mgmt.appplatform.v2020_11_01_preview.models.UserSourceType - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword version: Version of the source. - :paramtype version: str - :keyword artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :paramtype artifact_selector: str - """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py index 9827c7a11de..2b9bcb3d68b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,319 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. @@ -342,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -360,7 +65,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -372,27 +77,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,47 +114,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -465,19 +177,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -491,20 +201,14 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -518,22 +222,28 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -543,42 +253,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -588,17 +302,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -610,17 +323,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -633,18 +343,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -654,47 +371,52 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -711,19 +433,17 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -737,20 +457,14 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -764,22 +478,28 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -789,17 +509,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.AppResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -808,48 +528,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -858,11 +575,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -871,20 +584,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace def get_resource_upload_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -904,26 +616,29 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -936,19 +651,17 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace def validate_domain( self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -959,8 +672,7 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainValidateResult @@ -971,30 +683,34 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1007,6 +723,4 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py index e2701b47109..d2d143d8572 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.BindingResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py index 4ff2be51467..0dbefc75ad9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,185 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. @@ -208,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -235,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -327,19 +172,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> LROPoller["_models.CertificateResource"]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -350,24 +193,17 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -381,22 +217,28 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,42 +248,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -451,17 +297,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -473,17 +318,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -496,18 +338,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -517,17 +366,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.CertificateResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -536,48 +385,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +432,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +441,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py index 346ea8f011e..dd9d73e3d8a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,194 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -217,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -241,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -327,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -347,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -377,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -402,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -457,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -477,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -507,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -532,45 +364,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -587,18 +424,16 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace def begin_validate( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -607,24 +442,17 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -637,22 +465,27 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -662,6 +495,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py index 62862ed6d0f..9981f525763 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py index e5e73f78555..d88630d9689 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,445 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_cluster_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restart_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_log_file_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -468,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -498,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -531,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -593,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -619,24 +202,17 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -651,22 +227,29 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -676,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -723,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -748,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -772,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -793,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -852,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -878,24 +472,17 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -910,22 +497,29 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -935,19 +529,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -957,55 +551,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1014,11 +604,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1027,20 +613,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1048,53 +633,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1103,11 +685,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1116,46 +694,49 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1165,18 +746,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1190,17 +770,14 @@ def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1214,18 +791,26 @@ def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1235,44 +820,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1282,18 +871,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1307,17 +895,14 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1331,18 +916,26 @@ def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1352,44 +945,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1399,18 +996,17 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements + def begin_restart( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1424,17 +1020,14 @@ def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1448,18 +1041,26 @@ def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1469,19 +1070,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace def get_log_file_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1503,27 +1104,30 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1538,6 +1142,4 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py index 87a792fc8dd..a7544e77b78 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,150 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -173,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -197,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -283,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -303,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -333,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -358,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -413,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -433,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -463,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -488,6 +364,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py index ae325f2a61c..e93fd2c1410 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,50 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. @@ -73,49 +45,47 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +94,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,8 +103,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py index 1d749404a66..5c7e5ce3dc2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,49 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_runtime_versions_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -72,11 +44,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list_runtime_versions( self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -89,22 +61,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,6 +89,4 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py index cd97246f694..2aa4b23d010 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,447 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_test_keys_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_test_key_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_disable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_enable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. @@ -470,13 +47,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -494,25 +71,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -525,45 +105,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -583,18 +166,16 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -606,20 +187,14 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -632,22 +207,27 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,40 +237,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -700,16 +284,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -719,17 +302,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -741,18 +321,24 @@ def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -762,45 +348,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -817,18 +408,16 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -840,20 +429,14 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -866,22 +449,27 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -891,17 +479,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace def list_test_keys( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -919,25 +507,28 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -950,18 +541,16 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace def regenerate_test_key( self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -970,8 +559,7 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2020_11_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.TestKeys @@ -982,29 +570,33 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1017,17 +609,15 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + def disable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1045,25 +635,28 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1073,16 +666,15 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace def enable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1100,25 +692,28 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1131,24 +726,21 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace def check_name_availability( self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2020_11_01_preview.models.NameAvailability @@ -1159,28 +751,32 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2020-11-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1193,55 +789,53 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1250,11 +844,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1263,18 +853,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1282,44 +871,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1328,11 +916,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1341,8 +925,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py index a3281080aea..746347c182f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,56 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. @@ -79,52 +45,51 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.ResourceSkuCollection"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2020_11_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-11-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2020-11-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,11 +98,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -146,8 +107,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py index 41ec6d71ff7..d2ddf950056 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/__init__.py @@ -12,7 +12,8 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py index 58dad04d711..7deee559a53 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_app_platform_management_client.py @@ -6,119 +6,124 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from . import models + -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2021_06_01_preview.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2021_06_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2021_06_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2021_06_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2021_06_01_preview.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2021_06_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2021_06_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2021_06_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2021_06_01_preview.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2021_06_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_06_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2021_06_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2021_06_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - + self._deserialize = Deserializer(client_models) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse + :rtype: ~azure.core.pipeline.transport.HttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py index 2e1de152bfa..a358948766f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_configuration.py @@ -6,20 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any + from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,31 +29,26 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2021-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -71,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py index 44ce4a5043f..39f10548873 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/__init__.py @@ -8,8 +8,3 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py index 00782ca3942..dfc7ace8ede 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_app_platform_management_client.py @@ -6,119 +6,120 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .. import models + + +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations :vartype bindings: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.BindingsOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_06_01_preview.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - + self._deserialize = Deserializer(client_models) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py index fbe7cbe198a..80c22c56c44 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,12 +27,8 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-06-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -41,17 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2021-06-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -70,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py index e4832b4a1e8..4de955a7168 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,7 +60,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,27 +72,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +109,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _create_or_update_initial( self, @@ -127,30 +124,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -170,11 +171,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -196,20 +194,14 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -223,22 +215,28 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,11 +246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -264,26 +262,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -293,11 +294,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -315,17 +314,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,18 +334,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,9 +362,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _update_initial( self, @@ -376,30 +379,34 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -416,11 +423,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,20 +446,14 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -469,22 +467,28 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,11 +498,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace def list( self, resource_group_name: str, @@ -513,48 +516,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,11 +563,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,13 +572,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -609,26 +603,29 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,11 +638,8 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -664,8 +658,7 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult @@ -676,30 +669,34 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,6 +709,4 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py index 0f2eec3773b..b4572f289da 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py index f7706159a0d..60ac54d7607 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,11 +166,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,24 +186,17 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -220,22 +210,28 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -245,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -261,26 +257,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -290,11 +289,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -312,17 +309,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -335,18 +329,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -356,11 +357,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -375,48 +375,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,11 +422,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,8 +431,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py index cb88c6e435d..b032bebe43d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,9 +355,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _validate_initial( self, @@ -376,29 +371,33 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -415,11 +414,8 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -435,24 +431,17 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,22 +454,27 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,6 +484,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py index 5f08b6fde07..4c1b197d9f5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py index 7708eb9322b..ef6fc17c694 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,24 +195,17 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -230,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -272,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -327,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -351,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _update_initial( self, @@ -390,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -431,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -457,24 +461,17 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -489,22 +486,29 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -536,55 +539,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -593,11 +592,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,13 +601,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -627,53 +620,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,11 +672,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -695,13 +681,12 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -714,27 +699,30 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -744,11 +732,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -769,17 +755,14 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -793,18 +776,26 @@ async def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -814,11 +805,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -831,27 +822,30 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -861,11 +855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -886,17 +878,14 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -910,18 +899,26 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -931,11 +928,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, service_name: str, @@ -948,27 +945,30 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,11 +978,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements + async def begin_restart( self, resource_group_name: str, service_name: str, @@ -1003,17 +1001,14 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1027,18 +1022,26 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1048,11 +1051,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1082,27 +1084,30 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1117,6 +1122,4 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py index a77221d1d11..49ecf2833cd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,6 +355,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py index aa02a22d893..8ccd1eee431 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -53,40 +49,38 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,11 +89,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,8 +98,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py index 5a041d1ced2..1b2936a30aa 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,18 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._runtime_versions_operations import build_list_runtime_versions_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -60,22 +56,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,6 +84,4 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py index 781ed3086c6..a7d0539bc53 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -71,25 +66,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,9 +100,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _create_or_update_initial( self, @@ -118,29 +114,33 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,11 +160,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -183,20 +180,14 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -209,22 +200,27 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -234,11 +230,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -249,25 +245,28 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -277,11 +276,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -296,17 +293,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -318,18 +312,24 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _update_initial( self, @@ -355,29 +355,33 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -394,11 +398,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,20 +418,14 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -443,22 +438,27 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,11 +468,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -496,25 +495,28 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -527,11 +529,8 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -547,8 +546,7 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys @@ -559,29 +557,33 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -594,12 +596,9 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + async def disable_test_endpoint( self, resource_group_name: str, service_name: str, @@ -622,25 +621,28 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -650,10 +652,8 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,25 +677,28 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -708,11 +711,8 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace_async async def check_name_availability( self, location: str, @@ -724,8 +724,7 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability @@ -736,28 +735,32 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -770,11 +773,8 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -783,42 +783,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -827,11 +827,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -840,13 +836,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -859,44 +853,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -905,11 +898,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -918,8 +907,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py index 587c3832696..8ed38802659 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -52,44 +48,43 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,11 +93,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,8 +102,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py index 63bc9d3ed37..4fcc9dd5cc6 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/__init__.py @@ -6,82 +6,154 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import AvailableOperations -from ._models_py3 import AvailableRuntimeVersions -from ._models_py3 import BindingResource -from ._models_py3 import BindingResourceCollection -from ._models_py3 import BindingResourceProperties -from ._models_py3 import CertificateProperties -from ._models_py3 import CertificateResource -from ._models_py3 import CertificateResourceCollection -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterResourceProperties -from ._models_py3 import ConfigServerGitProperty -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerSettings -from ._models_py3 import ConfigServerSettingsErrorRecord -from ._models_py3 import ConfigServerSettingsValidateResult -from ._models_py3 import CustomContainer -from ._models_py3 import CustomDomainProperties -from ._models_py3 import CustomDomainResource -from ._models_py3 import CustomDomainResourceCollection -from ._models_py3 import CustomDomainValidatePayload -from ._models_py3 import CustomDomainValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import Error -from ._models_py3 import GitPatternRepository -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import MonitoringSettingProperties -from ._models_py3 import MonitoringSettingResource -from ._models_py3 import NameAvailability -from ._models_py3 import NameAvailabilityParameters -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileOutboundIPs -from ._models_py3 import OperationDetail -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationProperties -from ._models_py3 import PersistentDisk -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RequiredTraffic -from ._models_py3 import Resource -from ._models_py3 import ResourceRequests -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuCapabilities -from ._models_py3 import ResourceSkuCollection -from ._models_py3 import ResourceSkuLocationInfo -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import ResourceSkuZoneDetails -from ._models_py3 import ResourceUploadDefinition -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceList -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import TemporaryDisk -from ._models_py3 import TestKeys -from ._models_py3 import TrackedResource -from ._models_py3 import UserSourceInfo - +try: + from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection + from ._models_py3 import AppResourceProperties + from ._models_py3 import ApplicationInsightsAgentVersions + from ._models_py3 import AvailableOperations + from ._models_py3 import AvailableRuntimeVersions + from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection + from ._models_py3 import BindingResourceProperties + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody + from ._models_py3 import ClusterResourceProperties + from ._models_py3 import ConfigServerGitProperty + from ._models_py3 import ConfigServerProperties + from ._models_py3 import ConfigServerResource + from ._models_py3 import ConfigServerSettings + from ._models_py3 import ConfigServerSettingsErrorRecord + from ._models_py3 import ConfigServerSettingsValidateResult + from ._models_py3 import CustomContainer + from ._models_py3 import CustomDomainProperties + from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection + from ._models_py3 import CustomDomainValidatePayload + from ._models_py3 import CustomDomainValidateResult + from ._models_py3 import DeploymentInstance + from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection + from ._models_py3 import DeploymentResourceProperties + from ._models_py3 import DeploymentSettings + from ._models_py3 import Error + from ._models_py3 import GitPatternRepository + from ._models_py3 import ImageRegistryCredential + from ._models_py3 import LogFileUrlResponse + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentityProperties + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification + from ._models_py3 import MonitoringSettingProperties + from ._models_py3 import MonitoringSettingResource + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters + from ._models_py3 import NetworkProfile + from ._models_py3 import NetworkProfileOutboundIPs + from ._models_py3 import OperationDetail + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationProperties + from ._models_py3 import PersistentDisk + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateTestKeyRequestPayload + from ._models_py3 import RequiredTraffic + from ._models_py3 import Resource + from ._models_py3 import ResourceRequests + from ._models_py3 import ResourceSku + from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection + from ._models_py3 import ResourceSkuLocationInfo + from ._models_py3 import ResourceSkuRestrictionInfo + from ._models_py3 import ResourceSkuRestrictions + from ._models_py3 import ResourceSkuZoneDetails + from ._models_py3 import ResourceUploadDefinition + from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import SkuCapacity + from ._models_py3 import SupportedRuntimeVersion + from ._models_py3 import TemporaryDisk + from ._models_py3 import TestKeys + from ._models_py3 import TrackedResource + from ._models_py3 import UserSourceInfo +except (SyntaxError, ImportError): + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import ApplicationInsightsAgentVersions # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import CustomContainer # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import ImageRegistryCredential # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceRequests # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( - ActionType, AppResourceProvisioningState, ConfigServerState, DeploymentResourceProvisioningState, @@ -173,7 +245,6 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', - 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'DeploymentResourceProvisioningState', diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py index fa72f83379e..aa047f451ec 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_app_platform_management_client_enums.py @@ -6,18 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) - INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -26,7 +35,7 @@ class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -36,7 +45,7 @@ class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -45,7 +54,7 @@ class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -57,7 +66,7 @@ class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -66,7 +75,7 @@ class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -75,7 +84,7 @@ class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ @@ -89,7 +98,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -97,14 +106,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -112,7 +121,7 @@ class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -120,14 +129,14 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -135,21 +144,21 @@ class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py index 1cd1bb6ef9e..abec200ca32 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/models/_models_py3.py @@ -34,8 +34,6 @@ def __init__( self, **kwargs ): - """ - """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -69,8 +67,6 @@ def __init__( self, **kwargs ): - """ - """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -106,8 +102,6 @@ def __init__( self, **kwargs ): - """ - """ super(ProxyResource, self).__init__(**kwargs) @@ -122,12 +116,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties - :ivar location: The GEO location of the application, always the same with its parent resource. - :vartype location: str + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. + :type location: str """ _validation = { @@ -153,16 +147,6 @@ def __init__( location: Optional[str] = None, **kwargs ): - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -172,11 +156,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of App resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -191,13 +175,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -208,28 +185,28 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar public: Indicates whether the App exposes public endpoint. - :vartype public: bool + :param public: Indicates whether the App exposes public endpoint. + :type public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceProvisioningState - :ivar active_deployment_name: Name of the active deployment of the App. - :vartype active_deployment_name: str - :ivar fqdn: Fully qualified dns Name. - :vartype fqdn: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool + :param active_deployment_name: Name of the active deployment of the App. + :type active_deployment_name: str + :param fqdn: Fully qualified dns Name. + :type fqdn: str + :param https_only: Indicate if only https is allowed. + :type https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :ivar temporary_disk: Temporary disk settings. - :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk - :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :vartype enable_end_to_end_tls: bool + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk + :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :type enable_end_to_end_tls: bool """ _validation = { @@ -263,22 +240,6 @@ def __init__( enable_end_to_end_tls: Optional[bool] = False, **kwargs ): - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword active_deployment_name: Name of the active deployment of the App. - :paramtype active_deployment_name: str - :keyword fqdn: Fully qualified dns Name. - :paramtype fqdn: str - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword temporary_disk: Temporary disk settings. - :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_06_01_preview.models.PersistentDisk - :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :paramtype enable_end_to_end_tls: bool - """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -295,11 +256,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -314,13 +275,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDetail] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -348,8 +302,6 @@ def __init__( self, **kwargs ): - """ - """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -365,9 +317,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties """ _validation = { @@ -389,11 +340,6 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceProperties - """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -401,11 +347,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :ivar value: Collection of Binding resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -420,13 +366,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -441,12 +380,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :ivar resource_id: The Azure resource id of the bound resource. - :vartype resource_id: str - :ivar key: The key of the bound resource. - :vartype key: str - :ivar binding_parameters: Binding parameters of the Binding resource. - :vartype binding_parameters: dict[str, any] + :param resource_id: The Azure resource id of the bound resource. + :type resource_id: str + :param key: The key of the bound resource. + :type key: str + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -483,14 +422,6 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): - """ - :keyword resource_id: The Azure resource id of the bound resource. - :paramtype resource_id: str - :keyword key: The key of the bound resource. - :paramtype key: str - :keyword binding_parameters: Binding parameters of the Binding resource. - :paramtype binding_parameters: dict[str, any] - """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -511,12 +442,12 @@ class CertificateProperties(msrest.serialization.Model): :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str - :ivar vault_uri: Required. The vault uri of user key vault. - :vartype vault_uri: str - :ivar key_vault_cert_name: Required. The certificate name of key vault. - :vartype key_vault_cert_name: str - :ivar cert_version: The certificate version of key vault. - :vartype cert_version: str + :param vault_uri: Required. The vault uri of user key vault. + :type vault_uri: str + :param key_vault_cert_name: Required. The certificate name of key vault. + :type key_vault_cert_name: str + :param cert_version: The certificate version of key vault. + :type cert_version: str :ivar issuer: The issuer of certificate. :vartype issuer: str :ivar issued_date: The issue date of certificate. @@ -564,14 +495,6 @@ def __init__( cert_version: Optional[str] = None, **kwargs ): - """ - :keyword vault_uri: Required. The vault uri of user key vault. - :paramtype vault_uri: str - :keyword key_vault_cert_name: Required. The certificate name of key vault. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - """ super(CertificateProperties, self).__init__(**kwargs) self.thumbprint = None self.vault_uri = vault_uri @@ -596,8 +519,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties """ _validation = { @@ -619,10 +542,6 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateProperties - """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -630,10 +549,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :ivar value: The certificate resources list. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :ivar next_link: The link to next page of certificate list. - :vartype next_link: str + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { @@ -648,12 +567,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -662,17 +575,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + :param code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in + :type message: str + :param target: The target of the particular error. For example, the name of the property in error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -691,19 +604,6 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CloudErrorBody] - """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -721,8 +621,8 @@ class ClusterResourceProperties(msrest.serialization.Model): "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -748,10 +648,6 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfile - """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -764,27 +660,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar repositories: Repositories of git. - :vartype repositories: + :param repositories: Repositories of git. + :type repositories: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -819,29 +715,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.GitPatternRepository] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -864,10 +737,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :param error: Error when apply config server settings. + :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :param config_server: Settings of config server. + :type config_server: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings """ _validation = { @@ -887,13 +760,6 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings - """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -911,8 +777,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties """ _validation = { @@ -934,11 +800,6 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerProperties - """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -946,9 +807,8 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty + :param git_property: Property of git environment. + :type git_property: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -961,11 +821,6 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerGitProperty - """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -973,12 +828,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :ivar name: The name of the config server settings error record. - :vartype name: str - :ivar uri: The uri of the config server settings error record. - :vartype uri: str - :ivar messages: The detail error messages of the record. - :vartype messages: list[str] + :param name: The name of the config server settings error record. + :type name: str + :param uri: The uri of the config server settings error record. + :type uri: str + :param messages: The detail error messages of the record. + :type messages: list[str] """ _attribute_map = { @@ -995,14 +850,6 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): - """ - :keyword name: The name of the config server settings error record. - :paramtype name: str - :keyword uri: The uri of the config server settings error record. - :paramtype uri: str - :keyword messages: The detail error messages of the record. - :paramtype messages: list[str] - """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -1012,10 +859,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :ivar is_valid: Indicate if the config server settings are valid. - :vartype is_valid: bool - :ivar details: The detail validation results. - :vartype details: + :param is_valid: Indicate if the config server settings are valid. + :type is_valid: bool + :param details: The detail validation results. + :type details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -1031,13 +878,6 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): - """ - :keyword is_valid: Indicate if the config server settings are valid. - :paramtype is_valid: bool - :keyword details: The detail validation results. - :paramtype details: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsErrorRecord] - """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -1046,19 +886,19 @@ def __init__( class CustomContainer(msrest.serialization.Model): """Custom container payload. - :ivar server: The name of the registry that contains the container image. - :vartype server: str - :ivar container_image: Container image of the custom container. This should be in the form of + :param server: The name of the registry that contains the container image. + :type server: str + :param container_image: Container image of the custom container. This should be in the form of :code:``::code:`` without the server name of the registry. - :vartype container_image: str - :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + :type container_image: str + :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. - :vartype command: list[str] - :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not + :type command: list[str] + :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not provided. - :vartype args: list[str] - :ivar image_registry_credential: Credential of the image registry. - :vartype image_registry_credential: + :type args: list[str] + :param image_registry_credential: Credential of the image registry. + :type image_registry_credential: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential """ @@ -1080,22 +920,6 @@ def __init__( image_registry_credential: Optional["ImageRegistryCredential"] = None, **kwargs ): - """ - :keyword server: The name of the registry that contains the container image. - :paramtype server: str - :keyword container_image: Container image of the custom container. This should be in the form - of :code:``::code:`` without the server name of the registry. - :paramtype container_image: str - :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT - is used if this is not provided. - :paramtype command: list[str] - :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not - provided. - :paramtype args: list[str] - :keyword image_registry_credential: Credential of the image registry. - :paramtype image_registry_credential: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ImageRegistryCredential - """ super(CustomContainer, self).__init__(**kwargs) self.server = server self.container_image = container_image @@ -1109,12 +933,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str + :param thumbprint: The thumbprint of bound certificate. + :type thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :ivar cert_name: The bound certificate name of domain. - :vartype cert_name: str + :param cert_name: The bound certificate name of domain. + :type cert_name: str """ _validation = { @@ -1134,12 +958,6 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -1157,8 +975,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties + :param properties: Properties of the custom domain resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties """ _validation = { @@ -1180,11 +998,6 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainProperties - """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -1192,10 +1005,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :ivar value: The custom domain resources list. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :ivar next_link: The link to next page of custom domain list. - :vartype next_link: str + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str """ _attribute_map = { @@ -1210,12 +1023,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1226,8 +1033,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name to be validated. - :vartype name: str + :param name: Required. Name to be validated. + :type name: str """ _validation = { @@ -1244,10 +1051,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword name: Required. Name to be validated. - :paramtype name: str - """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1255,10 +1058,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :ivar is_valid: Indicates if domain name is valid. - :vartype is_valid: bool - :ivar message: Message of why domain name is invalid. - :vartype message: str + :param is_valid: Indicates if domain name is valid. + :type is_valid: bool + :param message: Message of why domain name is invalid. + :type message: str """ _attribute_map = { @@ -1273,12 +1076,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword is_valid: Indicates if domain name is valid. - :paramtype is_valid: bool - :keyword message: Message of why domain name is invalid. - :paramtype message: str - """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1321,8 +1118,6 @@ def __init__( self, **kwargs ): - """ - """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1342,11 +1137,11 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Deployment resource. - :vartype properties: + :param properties: Properties of the Deployment resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + :param sku: Sku of the Deployment resource. + :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -1370,13 +1165,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku - """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1385,11 +1173,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of Deployment resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1404,13 +1192,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1421,12 +1202,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar source: Uploaded source information of the deployment. - :vartype source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo + :param source: Uploaded source information of the deployment. + :type source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: + :param deployment_settings: Deployment settings of the Deployment. + :type deployment_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -1471,13 +1252,6 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentSettings - """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1492,28 +1266,27 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :ivar cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + :param cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard tier. This is deprecated starting from API version 2021-06-01-preview. Please use the resourceRequests field to set the CPU size. - :vartype cpu: int - :ivar memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, + :type cpu: int + :param memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version 2021-06-01-preview. Please use the resourceRequests field to set the the memory size. - :vartype memory_in_gb: int - :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is + :type memory_in_gb: int + :param resource_requests: The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. - :vartype resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. - :vartype net_core_main_entry_path: str - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :type resource_requests: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests + :param jvm_options: JVM parameter. + :type jvm_options: str + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. + :type net_core_main_entry_path: str + :param environment_variables: Collection of environment variables. + :type environment_variables: dict[str, str] + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :vartype runtime_version: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion + :type runtime_version: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion """ _attribute_map = { @@ -1538,31 +1311,6 @@ def __init__( runtime_version: Optional[Union[str, "RuntimeVersion"]] = "Java_8", **kwargs ): - """ - :keyword cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard - tier. This is deprecated starting from API version 2021-06-01-preview. Please use the - resourceRequests field to set the CPU size. - :paramtype cpu: int - :keyword memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic - tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version - 2021-06-01-preview. Please use the resourceRequests field to set the the memory size. - :paramtype memory_in_gb: int - :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceRequests - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. - :paramtype net_core_main_entry_path: str - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", - "NetCore_31". Default value: "Java_8". - :paramtype runtime_version: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RuntimeVersion - """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1576,10 +1324,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :ivar code: The code of error. - :vartype code: str - :ivar message: The message of error. - :vartype message: str + :param code: The code of error. + :type code: str + :param message: The message of error. + :type message: str """ _attribute_map = { @@ -1594,12 +1342,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1610,28 +1352,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param name: Required. Name of the repository. + :type name: str + :param pattern: Collection of pattern of the repository. + :type pattern: list[str] + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -1669,30 +1411,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -1710,10 +1428,10 @@ def __init__( class ImageRegistryCredential(msrest.serialization.Model): """Credential of the image registry. - :ivar username: The username of the image registry credential. - :vartype username: str - :ivar password: The password of the image registry credential. - :vartype password: str + :param username: The username of the image registry credential. + :type username: str + :param password: The password of the image registry credential. + :type password: str """ _attribute_map = { @@ -1728,12 +1446,6 @@ def __init__( password: Optional[str] = None, **kwargs ): - """ - :keyword username: The username of the image registry credential. - :paramtype username: str - :keyword password: The password of the image registry credential. - :paramtype password: str - """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = username self.password = password @@ -1744,8 +1456,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar url: Required. URL of the log file. - :vartype url: str + :param url: Required. URL of the log file. + :type url: str """ _validation = { @@ -1762,10 +1474,6 @@ def __init__( url: str, **kwargs ): - """ - :keyword url: Required. URL of the log file. - :paramtype url: str - """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -1773,12 +1481,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str """ _attribute_map = { @@ -1795,14 +1503,6 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1812,13 +1512,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id. - :vartype principal_id: str - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str + :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. + :type principal_id: str + :param tenant_id: Tenant Id. + :type tenant_id: str """ _attribute_map = { @@ -1835,15 +1535,6 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): - """ - :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -1853,13 +1544,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :param name: Name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :vartype to_be_exported_for_shoebox: bool + :type to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1876,15 +1567,6 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :paramtype to_be_exported_for_shoebox: bool - """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1894,31 +1576,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: Unit that makes sense for the metric. + :type unit: str + :param category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :type category: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :type aggregation_type: str + :param supported_aggregation_types: Supported aggregation types. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: Supported time grain types. + :type supported_time_grain_types: list[str] + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] - :ivar source_mdm_namespace: Name of the MDM namespace. Optional. - :vartype source_mdm_namespace: str + :type fill_gap_with_zero: bool + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] + :param source_mdm_namespace: Name of the MDM namespace. Optional. + :type source_mdm_namespace: str """ _attribute_map = { @@ -1951,33 +1633,6 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2001,20 +1656,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated - since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate - if monitoringSettings enabled or not. - :vartype trace_enabled: bool - :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or - whitespace include empty will disable monitoringSettings. - :vartype app_insights_instrumentation_key: str - :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :param error: Error when apply Monitoring Setting changes. + :type error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :type trace_enabled: bool + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :type app_insights_instrumentation_key: str + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :vartype app_insights_sampling_rate: float - :ivar app_insights_agent_versions: Indicates the versions of application insight agent. - :vartype app_insights_agent_versions: + :type app_insights_sampling_rate: float + :param app_insights_agent_versions: Indicates the versions of application insight agent. + :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions """ @@ -2042,23 +1697,6 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Error - :keyword trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :paramtype trace_enabled: bool - :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :paramtype app_insights_instrumentation_key: str - :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :paramtype app_insights_sampling_rate: float - :keyword app_insights_agent_versions: Indicates the versions of application insight agent. - :paramtype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ApplicationInsightsAgentVersions - """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -2079,8 +1717,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: + :param properties: Properties of the Monitoring Setting resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties """ @@ -2103,11 +1741,6 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingProperties - """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -2115,12 +1748,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: Reason why the name is not available. - :vartype reason: str - :ivar message: Message why the name is not available. - :vartype message: str + :param name_available: Indicates whether the name is available. + :type name_available: bool + :param reason: Reason why the name is not available. + :type reason: str + :param message: Message why the name is not available. + :type message: str """ _attribute_map = { @@ -2137,14 +1770,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword name_available: Indicates whether the name is available. - :paramtype name_available: bool - :keyword reason: Reason why the name is not available. - :paramtype reason: str - :keyword message: Message why the name is not available. - :paramtype message: str - """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2156,10 +1781,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the resource to check name availability. - :vartype type: str - :ivar name: Required. Name to be checked. - :vartype name: str + :param type: Required. Type of the resource to check name availability. + :type type: str + :param name: Required. Name to be checked. + :type name: str """ _validation = { @@ -2179,12 +1804,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword type: Required. Type of the resource to check name availability. - :paramtype type: str - :keyword name: Required. Name to be checked. - :paramtype name: str - """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -2195,19 +1814,20 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring - Cloud Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Cloud service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :type service_runtime_subnet_id: str + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :type app_subnet_id: str + :param service_cidr: Azure Spring Cloud service reserved CIDR. + :type service_cidr: str + :param service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources of + :type service_runtime_network_resource_group: str + :param app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :vartype app_network_resource_group: str + :type app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NetworkProfileOutboundIPs @@ -2241,22 +1861,6 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Cloud service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Cloud Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :paramtype app_network_resource_group: str - """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -2288,8 +1892,6 @@ def __init__( self, **kwargs ): - """ - """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -2297,32 +1899,22 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - Variables are only populated by the server, and will be ignored when sending a request. - - :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.appplatform.v2021_06_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties """ - _validation = { - 'action_type': {'readonly': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -2337,23 +1929,10 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): - """ - :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.appplatform.v2021_06_01_preview.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.OperationProperties - """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display - self.action_type = None self.origin = origin self.properties = properties @@ -2361,14 +1940,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :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 + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Resource of the operation. + :type resource: str + :param operation: Localized friendly name for the operation. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str """ _attribute_map = { @@ -2387,16 +1966,6 @@ def __init__( description: Optional[str] = None, **kwargs ): - """ - :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2407,8 +1976,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification """ @@ -2422,11 +1991,6 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceSpecification - """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2436,12 +2000,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar size_in_gb: Size of the persistent disk in GB. - :vartype size_in_gb: int + :param size_in_gb: Size of the persistent disk in GB. + :type size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :ivar mount_path: Mount path of the persistent disk. - :vartype mount_path: str + :param mount_path: Mount path of the persistent disk. + :type mount_path: str """ _validation = { @@ -2462,12 +2026,6 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): - """ - :keyword size_in_gb: Size of the persistent disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the persistent disk. - :paramtype mount_path: str - """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -2479,9 +2037,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + :param key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType + :type key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType """ _validation = { @@ -2498,11 +2056,6 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): - """ - :keyword key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeyType - """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2545,8 +2098,6 @@ def __init__( self, **kwargs ): - """ - """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2558,12 +2109,12 @@ def __init__( class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :vartype cpu: str - :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, - 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :vartype memory: str + :type cpu: str + :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :type memory: str """ _attribute_map = { @@ -2578,14 +2129,6 @@ def __init__( memory: Optional[str] = None, **kwargs ): - """ - :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 - for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :paramtype cpu: str - :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :paramtype memory: str - """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -2594,23 +2137,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :ivar resource_type: Gets the type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: Gets the name of SKU. - :vartype name: str - :ivar tier: Gets the tier of SKU. - :vartype tier: str - :ivar capacity: Gets the capacity of SKU. - :vartype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity - :ivar locations: Gets the set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Gets a list of locations and availability zones in those locations where + :param resource_type: Gets the type of resource the SKU applies to. + :type resource_type: str + :param name: Gets the name of SKU. + :type name: str + :param tier: Gets the tier of SKU. + :type tier: str + :param capacity: Gets the capacity of SKU. + :type capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity + :param locations: Gets the set of locations that the SKU is available. + :type locations: list[str] + :param location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :vartype location_info: + :type location_info: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] - :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :vartype restrictions: + :type restrictions: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] """ @@ -2636,26 +2179,6 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): - """ - :keyword resource_type: Gets the type of resource the SKU applies to. - :paramtype resource_type: str - :keyword name: Gets the name of SKU. - :paramtype name: str - :keyword tier: Gets the tier of SKU. - :paramtype tier: str - :keyword capacity: Gets the capacity of SKU. - :paramtype capacity: ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuCapacity - :keyword locations: Gets the set of locations that the SKU is available. - :paramtype locations: list[str] - :keyword location_info: Gets a list of locations and availability zones in those locations - where the SKU is available. - :paramtype location_info: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuLocationInfo] - :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :paramtype restrictions: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictions] - """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -2669,10 +2192,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :ivar name: Gets an invariant to describe the feature. - :vartype name: str - :ivar value: Gets an invariant if the feature is measured by quantity. - :vartype value: str + :param name: Gets an invariant to describe the feature. + :type name: str + :param value: Gets an invariant if the feature is measured by quantity. + :type value: str """ _attribute_map = { @@ -2687,12 +2210,6 @@ def __init__( value: Optional[str] = None, **kwargs ): - """ - :keyword name: Gets an invariant to describe the feature. - :paramtype name: str - :keyword value: Gets an invariant if the feature is measured by quantity. - :paramtype value: str - """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -2701,11 +2218,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -2720,13 +2237,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSku] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2735,12 +2245,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :ivar location: Gets location of the SKU. - :vartype location: str - :ivar zones: Gets list of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. - :vartype zone_details: + :param location: Gets location of the SKU. + :type location: str + :param zones: Gets list of availability zones where the SKU is supported. + :type zones: list[str] + :param zone_details: Gets details of capabilities available to a SKU in specific zones. + :type zone_details: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] """ @@ -2758,15 +2268,6 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): - """ - :keyword location: Gets location of the SKU. - :paramtype location: str - :keyword zones: Gets list of availability zones where the SKU is supported. - :paramtype zones: list[str] - :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. - :paramtype zone_details: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuZoneDetails] - """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -2776,10 +2277,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :ivar locations: Gets locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: Gets list of availability zones where the SKU is restricted. - :vartype zones: list[str] + :param locations: Gets locations where the SKU is restricted. + :type locations: list[str] + :param zones: Gets list of availability zones where the SKU is restricted. + :type zones: list[str] """ _attribute_map = { @@ -2794,12 +2295,6 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): - """ - :keyword locations: Gets locations where the SKU is restricted. - :paramtype locations: list[str] - :keyword zones: Gets list of availability zones where the SKU is restricted. - :paramtype zones: list[str] - """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -2808,21 +2303,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :vartype type: str or + :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType - :ivar values: Gets the value of restrictions. If the restriction type is set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + :type values: list[str] + :param restriction_info: Gets the information about the restriction where the SKU cannot be used. - :vartype restriction_info: + :type restriction_info: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or + :type reason_code: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -2842,24 +2337,6 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsType - :keyword values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :paramtype values: list[str] - :keyword restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :paramtype restriction_info: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuRestrictionsReasonCode - """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -2870,12 +2347,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :ivar name: Gets the set of zones that the SKU is available in with the + :param name: Gets the set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + :type name: list[str] + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :vartype capabilities: + :type capabilities: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] """ @@ -2891,15 +2368,6 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): - """ - :keyword name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :paramtype name: list[str] - :keyword capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :paramtype capabilities: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCapabilities] - """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -2908,10 +2376,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :ivar relative_path: Source relative path. - :vartype relative_path: str - :ivar upload_url: Upload URL. - :vartype upload_url: str + :param relative_path: Source relative path. + :type relative_path: str + :param upload_url: Upload URL. + :type upload_url: str """ _attribute_map = { @@ -2926,12 +2394,6 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -2948,11 +2410,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] """ _validation = { @@ -2976,13 +2438,6 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2999,16 +2454,15 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the Service resource. - :vartype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. + :type sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku """ _validation = { @@ -3036,18 +2490,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the Service resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2021_06_01_preview.models.Sku - """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -3056,11 +2498,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :ivar value: Collection of Service resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -3075,13 +2517,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3090,11 +2525,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] """ @@ -3110,14 +2545,6 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2021_06_01_preview.models.MetricSpecification] - """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -3126,12 +2553,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :ivar name: Name of the Sku. - :vartype name: str - :ivar tier: Tier of the Sku. - :vartype tier: str - :ivar capacity: Current capacity of the target resource. - :vartype capacity: int + :param name: Name of the Sku. + :type name: str + :param tier: Tier of the Sku. + :type tier: str + :param capacity: Current capacity of the target resource. + :type capacity: int """ _attribute_map = { @@ -3148,14 +2575,6 @@ def __init__( capacity: Optional[int] = None, **kwargs ): - """ - :keyword name: Name of the Sku. - :paramtype name: str - :keyword tier: Tier of the Sku. - :paramtype tier: str - :keyword capacity: Current capacity of the target resource. - :paramtype capacity: int - """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -3167,15 +2586,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar minimum: Required. Gets or sets the minimum. - :vartype minimum: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar default: Gets or sets the default. - :vartype default: int - :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + :param minimum: Required. Gets or sets the minimum. + :type minimum: int + :param maximum: Gets or sets the maximum. + :type maximum: int + :param default: Gets or sets the default. + :type default: int + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType + :type scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType """ _validation = { @@ -3198,17 +2617,6 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): - """ - :keyword minimum: Required. Gets or sets the minimum. - :paramtype minimum: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword default: Gets or sets the default. - :paramtype default: int - :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SkuScaleType - """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -3219,15 +2627,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values - include: "Java_8", "Java_11", "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :vartype platform: str or + :type platform: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform - :ivar version: The detailed version (major.minor) of the platform. - :vartype version: str + :param version: The detailed version (major.minor) of the platform. + :type version: str """ _attribute_map = { @@ -3244,18 +2652,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2021_06_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -3265,10 +2661,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :ivar size_in_gb: Size of the temporary disk in GB. - :vartype size_in_gb: int - :ivar mount_path: Mount path of the temporary disk. - :vartype mount_path: str + :param size_in_gb: Size of the temporary disk in GB. + :type size_in_gb: int + :param mount_path: Mount path of the temporary disk. + :type mount_path: str """ _validation = { @@ -3287,12 +2683,6 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): - """ - :keyword size_in_gb: Size of the temporary disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the temporary disk. - :paramtype mount_path: str - """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -3301,16 +2691,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :ivar primary_key: Primary key. - :vartype primary_key: str - :ivar secondary_key: Secondary key. - :vartype secondary_key: str - :ivar primary_test_endpoint: Primary test endpoint. - :vartype primary_test_endpoint: str - :ivar secondary_test_endpoint: Secondary test endpoint. - :vartype secondary_test_endpoint: str - :ivar enabled: Indicates whether the test endpoint feature enabled or not. - :vartype enabled: bool + :param primary_key: Primary key. + :type primary_key: str + :param secondary_key: Secondary key. + :type secondary_key: str + :param primary_test_endpoint: Primary test endpoint. + :type primary_test_endpoint: str + :param secondary_test_endpoint: Secondary test endpoint. + :type secondary_test_endpoint: str + :param enabled: Indicates whether the test endpoint feature enabled or not. + :type enabled: bool """ _attribute_map = { @@ -3331,18 +2721,6 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): - """ - :keyword primary_key: Primary key. - :paramtype primary_key: str - :keyword secondary_key: Secondary key. - :paramtype secondary_key: str - :keyword primary_test_endpoint: Primary test endpoint. - :paramtype primary_test_endpoint: str - :keyword secondary_test_endpoint: Secondary test endpoint. - :paramtype secondary_test_endpoint: str - :keyword enabled: Indicates whether the test endpoint feature enabled or not. - :paramtype enabled: bool - """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -3354,19 +2732,19 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source", "Container". - :vartype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar version: Version of the source. - :vartype version: str - :ivar artifact_selector: Selector for the artifact to be used for the deployment for + :type type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str + :param version: Version of the source. + :type version: str + :param artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :vartype artifact_selector: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer + :type artifact_selector: str + :param custom_container: Custom container payload. + :type custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer """ _attribute_map = { @@ -3387,21 +2765,6 @@ def __init__( custom_container: Optional["CustomContainer"] = None, **kwargs ): - """ - :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source", "Container". - :paramtype type: str or ~azure.mgmt.appplatform.v2021_06_01_preview.models.UserSourceType - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword version: Version of the source. - :paramtype version: str - :keyword artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :paramtype artifact_selector: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomContainer - """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py index 495ec7d7c6f..eea853d9933 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,319 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. @@ -342,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -360,7 +65,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -372,27 +77,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,47 +114,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -465,19 +177,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -491,20 +201,14 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -518,22 +222,28 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -543,42 +253,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -588,17 +302,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -610,17 +323,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -633,18 +343,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -654,47 +371,52 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -711,19 +433,17 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -737,20 +457,14 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -764,22 +478,28 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -789,17 +509,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.AppResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -808,48 +528,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -858,11 +575,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -871,20 +584,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace def get_resource_upload_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -904,26 +616,29 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -936,19 +651,17 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace def validate_domain( self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -959,8 +672,7 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainValidateResult @@ -971,30 +683,34 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1007,6 +723,4 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py index 4bca4feeddd..055f8f16cc1 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.BindingResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py index a2400cb2ad9..51ba407eef8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,185 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. @@ -208,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -235,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -327,19 +172,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> LROPoller["_models.CertificateResource"]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -350,24 +193,17 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -381,22 +217,28 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,42 +248,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -451,17 +297,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -473,17 +318,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -496,18 +338,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -517,17 +366,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.CertificateResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -536,48 +385,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +432,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +441,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py index be6583d00cf..aba3e06c24d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,194 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -217,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -241,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -327,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -347,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -377,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -402,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -457,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -477,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -507,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -532,45 +364,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -587,18 +424,16 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace def begin_validate( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -607,24 +442,17 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -637,22 +465,27 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -662,6 +495,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py index 5811473a259..e7e4cafb94e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py index 878dba4ee93..0c1fe5d247f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,445 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_cluster_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restart_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_log_file_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class DeploymentsOperations(object): """DeploymentsOperations operations. @@ -468,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -498,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -531,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -593,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -619,24 +202,17 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -651,22 +227,29 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -676,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -723,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -748,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -772,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -793,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -852,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -878,24 +472,17 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -910,22 +497,29 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -935,19 +529,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -957,55 +551,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1014,11 +604,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1027,20 +613,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1048,53 +633,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1103,11 +685,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1116,46 +694,49 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1165,18 +746,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1190,17 +770,14 @@ def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1214,18 +791,26 @@ def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1235,44 +820,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1282,18 +871,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1307,17 +895,14 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1331,18 +916,26 @@ def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1352,44 +945,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1399,18 +996,17 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements + def begin_restart( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1424,17 +1020,14 @@ def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1448,18 +1041,26 @@ def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1469,19 +1070,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace def get_log_file_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1503,27 +1104,30 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1538,6 +1142,4 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py index 405aed124cf..4b278909b72 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,150 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -173,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -197,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -283,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -303,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -333,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -358,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -413,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -433,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -463,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -488,6 +364,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py index 6fcbd324a4d..3a411f52957 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,50 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. @@ -73,49 +45,47 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +94,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,8 +103,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py index 0a7e191e140..26067aebd4f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,49 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_runtime_versions_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -72,11 +44,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list_runtime_versions( self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -89,22 +61,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,6 +89,4 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py index d4bc50e58e2..ec19c6b6bc1 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,447 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_test_keys_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_test_key_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_disable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_enable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. @@ -470,13 +47,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -494,25 +71,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -525,45 +105,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -583,18 +166,16 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -606,20 +187,14 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -632,22 +207,27 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -657,40 +237,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -700,16 +284,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -719,17 +302,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -741,18 +321,24 @@ def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -762,45 +348,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -817,18 +408,16 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -840,20 +429,14 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -866,22 +449,27 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -891,17 +479,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace def list_test_keys( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -919,25 +507,28 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -950,18 +541,16 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace def regenerate_test_key( self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -970,8 +559,7 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_06_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.TestKeys @@ -982,29 +570,33 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1017,17 +609,15 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + def disable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1045,25 +635,28 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1073,16 +666,15 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace def enable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1100,25 +692,28 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1131,24 +726,21 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace def check_name_availability( self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_06_01_preview.models.NameAvailability @@ -1159,28 +751,32 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1193,55 +789,53 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1250,11 +844,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1263,18 +853,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1282,44 +871,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1328,11 +916,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1341,8 +925,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py index aa37e824b96..8ebe4102035 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,56 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. @@ -79,52 +45,51 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.ResourceSkuCollection"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_06_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,11 +98,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -146,8 +107,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py index 41ec6d71ff7..d2ddf950056 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/__init__.py @@ -12,7 +12,8 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py index a2e6e673b5e..2f120a460b9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_app_platform_management_client.py @@ -6,33 +6,43 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations, StoragesOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import StoragesOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from . import models + -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_09_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2021_09_01_preview.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2021_09_01_preview.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2021_09_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2021_09_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_09_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -40,88 +50,85 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2021_09_01_preview.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2021_09_01_preview.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2021_09_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2021_09_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2021_09_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2021_09_01_preview.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2021_09_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_09_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2021_09_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2021_09_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_09_01_preview.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - + self._deserialize = Deserializer(client_models) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse + :rtype: ~azure.core.pipeline.transport.HttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py index 39fcf5f8106..e3b3c943b4e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_configuration.py @@ -6,20 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any + from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,31 +29,26 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2021-09-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -71,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py index 92453d8691d..e5754a47ce6 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.1.0" +VERSION = "1.0.0b1" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py index 44ce4a5043f..39f10548873 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/__init__.py @@ -8,8 +8,3 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py index 7510f58ba56..c8694042146 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_app_platform_management_client.py @@ -6,33 +6,41 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, CertificatesOperations, ConfigServersOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServicesOperations, SkusOperations, StoragesOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import StoragesOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .. import models + + +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.ConfigServersOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -40,88 +48,83 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2021_09_01_preview.aio.operations.SkusOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :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 "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - + self._deserialize = Deserializer(client_models) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py index 15ee10bc893..987657fd65f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,12 +27,8 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2021-09-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -41,17 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2021-09-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -70,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py index 32287620c0c..6aa56a5cb40 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_update_request_initial, build_validate_domain_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,7 +60,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,27 +72,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +109,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _create_or_update_initial( self, @@ -127,30 +124,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -170,11 +171,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -196,20 +194,14 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -223,22 +215,28 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,11 +246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -264,26 +262,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -293,11 +294,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -315,17 +314,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,18 +334,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,9 +362,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _update_initial( self, @@ -376,30 +379,34 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -416,11 +423,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,20 +446,14 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -469,22 +467,28 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,11 +498,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace def list( self, resource_group_name: str, @@ -513,48 +516,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,11 +563,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,13 +572,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -609,26 +603,29 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,11 +638,8 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -664,8 +658,7 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult @@ -676,30 +669,34 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -712,6 +709,4 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py index a025d57361c..e04b1377962 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py index 4bce9de5415..da8a9ebd586 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,11 +166,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,24 +186,17 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -220,22 +210,28 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -245,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -261,26 +257,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -290,11 +289,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -312,17 +309,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -335,18 +329,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -356,11 +357,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -375,48 +375,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,11 +422,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,8 +431,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py index eb9e2089344..0a9e48f21c0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,9 +355,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _validate_initial( self, @@ -376,29 +371,33 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -415,11 +414,8 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -435,24 +431,17 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,22 +454,27 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,6 +484,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py index b3339004bb0..d177c42ecfb 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py index aa308ba024c..5b7627bab92 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,26 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DeploymentsOperations: # pylint: disable=too-many-public-methods +class DeploymentsOperations: """DeploymentsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,24 +195,17 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -230,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -272,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -327,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -351,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _update_initial( self, @@ -390,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -431,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -457,24 +461,17 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -489,22 +486,29 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -536,55 +539,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -593,11 +592,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,13 +601,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -627,53 +620,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,11 +672,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -695,13 +681,12 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -714,27 +699,30 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -744,11 +732,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -769,17 +755,14 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -793,18 +776,26 @@ async def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -814,11 +805,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -831,27 +822,30 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -861,11 +855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -886,17 +878,14 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -910,18 +899,26 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -931,11 +928,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, service_name: str, @@ -948,27 +945,30 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,11 +978,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements + async def begin_restart( self, resource_group_name: str, service_name: str, @@ -1003,17 +1001,14 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1027,18 +1022,26 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1048,11 +1051,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1082,27 +1084,30 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1117,11 +1122,9 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + async def _generate_heap_dump_initial( self, resource_group_name: str, service_name: str, @@ -1135,31 +1138,35 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_heap_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1169,11 +1176,9 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - - @distributed_trace_async - async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + async def begin_generate_heap_dump( self, resource_group_name: str, service_name: str, @@ -1194,22 +1199,17 @@ async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-state :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1224,19 +1224,26 @@ async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-state app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1246,11 +1253,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + async def _generate_thread_dump_initial( self, resource_group_name: str, service_name: str, @@ -1264,31 +1271,35 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_thread_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1298,11 +1309,9 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - @distributed_trace_async - async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + async def begin_generate_thread_dump( self, resource_group_name: str, service_name: str, @@ -1323,22 +1332,17 @@ async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-sta :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1353,19 +1357,26 @@ async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-sta app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1375,11 +1386,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + async def _start_jfr_initial( self, resource_group_name: str, service_name: str, @@ -1393,31 +1404,35 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._start_jfr_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1427,11 +1442,9 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore + _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore - - @distributed_trace_async - async def begin_start_jfr( # pylint: disable=inconsistent-return-statements + async def begin_start_jfr( self, resource_group_name: str, service_name: str, @@ -1452,22 +1465,17 @@ async def begin_start_jfr( # pylint: disable=inconsistent-return-statements :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1482,19 +1490,26 @@ async def begin_start_jfr( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1504,6 +1519,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py index 53bd1b1ea59..a5fc03172e4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,6 +355,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py index 2cb744db303..4e200df142c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -53,40 +49,38 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,11 +89,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,8 +98,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py index e5c15de66f4..aed78e05840 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,18 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._runtime_versions_operations import build_list_runtime_versions_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -60,22 +56,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,6 +84,4 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py index 2db37f6e3f7..61df1387172 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -71,25 +66,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,9 +100,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _create_or_update_initial( self, @@ -118,29 +114,33 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,11 +160,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -183,20 +180,14 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -209,22 +200,27 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -234,11 +230,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -249,25 +245,28 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -277,11 +276,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -296,17 +293,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -318,18 +312,24 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _update_initial( self, @@ -355,29 +355,33 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -394,11 +398,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,20 +418,14 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -443,22 +438,27 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,11 +468,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -496,25 +495,28 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -527,11 +529,8 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -547,8 +546,7 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys @@ -559,29 +557,33 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -594,12 +596,9 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + async def disable_test_endpoint( self, resource_group_name: str, service_name: str, @@ -622,25 +621,28 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -650,10 +652,8 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,25 +677,28 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -708,11 +711,9 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -723,25 +724,28 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -751,11 +755,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -770,17 +772,14 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -792,18 +791,24 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements raw_result = await self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -813,11 +818,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -828,25 +833,28 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -856,11 +864,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -875,17 +881,14 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -897,18 +900,24 @@ async def begin_start( # pylint: disable=inconsistent-return-statements raw_result = await self._start_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -918,11 +927,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - - @distributed_trace_async async def check_name_availability( self, location: str, @@ -934,8 +942,7 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability @@ -946,28 +953,32 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -980,11 +991,8 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -993,42 +1001,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1037,11 +1045,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1050,13 +1054,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -1069,44 +1071,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1115,11 +1116,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1128,8 +1125,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py index 69130ae774a..f89076c649b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -52,44 +48,43 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,11 +93,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,8 +102,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py index e8f8d2a5f3b..e470058c3ec 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/operations/_storages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._storages_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(storage_resource, 'StorageResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(storage_resource, 'StorageResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,11 +166,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -192,20 +189,14 @@ async def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -219,22 +210,28 @@ async def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -244,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -260,26 +257,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,11 +289,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -311,17 +309,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,18 +329,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,11 +357,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -374,48 +375,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("StorageResourceCollection", pipeline_response) + deserialized = self._deserialize('StorageResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -424,11 +422,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -437,8 +431,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py index 169c88204eb..8bde0d949a7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/__init__.py @@ -6,95 +6,180 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import AvailableOperations -from ._models_py3 import AvailableRuntimeVersions -from ._models_py3 import AzureFileVolume -from ._models_py3 import BindingResource -from ._models_py3 import BindingResourceCollection -from ._models_py3 import BindingResourceProperties -from ._models_py3 import CertificateProperties -from ._models_py3 import CertificateResource -from ._models_py3 import CertificateResourceCollection -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterResourceProperties -from ._models_py3 import ConfigServerGitProperty -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerSettings -from ._models_py3 import ConfigServerSettingsErrorRecord -from ._models_py3 import ConfigServerSettingsValidateResult -from ._models_py3 import ContentCertificateProperties -from ._models_py3 import CustomContainer -from ._models_py3 import CustomDomainProperties -from ._models_py3 import CustomDomainResource -from ._models_py3 import CustomDomainResourceCollection -from ._models_py3 import CustomDomainValidatePayload -from ._models_py3 import CustomDomainValidateResult -from ._models_py3 import CustomPersistentDiskProperties -from ._models_py3 import CustomPersistentDiskResource -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DeploymentSettingsContainerProbeSettings -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import GitPatternRepository -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import KeyVaultCertificateProperties -from ._models_py3 import LoadedCertificate -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import MonitoringSettingProperties -from ._models_py3 import MonitoringSettingResource -from ._models_py3 import NameAvailability -from ._models_py3 import NameAvailabilityParameters -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileOutboundIPs -from ._models_py3 import OperationDetail -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationProperties -from ._models_py3 import PersistentDisk -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RequiredTraffic -from ._models_py3 import Resource -from ._models_py3 import ResourceRequests -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuCapabilities -from ._models_py3 import ResourceSkuCollection -from ._models_py3 import ResourceSkuLocationInfo -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import ResourceSkuZoneDetails -from ._models_py3 import ResourceUploadDefinition -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceList -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import StorageAccount -from ._models_py3 import StorageProperties -from ._models_py3 import StorageResource -from ._models_py3 import StorageResourceCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SystemData -from ._models_py3 import TemporaryDisk -from ._models_py3 import TestKeys -from ._models_py3 import TrackedResource -from ._models_py3 import UserSourceInfo - +try: + from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection + from ._models_py3 import AppResourceProperties + from ._models_py3 import ApplicationInsightsAgentVersions + from ._models_py3 import AvailableOperations + from ._models_py3 import AvailableRuntimeVersions + from ._models_py3 import AzureFileVolume + from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection + from ._models_py3 import BindingResourceProperties + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody + from ._models_py3 import ClusterResourceProperties + from ._models_py3 import ConfigServerGitProperty + from ._models_py3 import ConfigServerProperties + from ._models_py3 import ConfigServerResource + from ._models_py3 import ConfigServerSettings + from ._models_py3 import ConfigServerSettingsErrorRecord + from ._models_py3 import ConfigServerSettingsValidateResult + from ._models_py3 import ContentCertificateProperties + from ._models_py3 import CustomContainer + from ._models_py3 import CustomDomainProperties + from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection + from ._models_py3 import CustomDomainValidatePayload + from ._models_py3 import CustomDomainValidateResult + from ._models_py3 import CustomPersistentDiskProperties + from ._models_py3 import CustomPersistentDiskResource + from ._models_py3 import DeploymentInstance + from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection + from ._models_py3 import DeploymentResourceProperties + from ._models_py3 import DeploymentSettings + from ._models_py3 import DeploymentSettingsContainerProbeSettings + from ._models_py3 import DiagnosticParameters + from ._models_py3 import Error + from ._models_py3 import GitPatternRepository + from ._models_py3 import ImageRegistryCredential + from ._models_py3 import KeyVaultCertificateProperties + from ._models_py3 import LoadedCertificate + from ._models_py3 import LogFileUrlResponse + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentityProperties + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification + from ._models_py3 import MonitoringSettingProperties + from ._models_py3 import MonitoringSettingResource + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters + from ._models_py3 import NetworkProfile + from ._models_py3 import NetworkProfileOutboundIPs + from ._models_py3 import OperationDetail + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationProperties + from ._models_py3 import PersistentDisk + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateTestKeyRequestPayload + from ._models_py3 import RequiredTraffic + from ._models_py3 import Resource + from ._models_py3 import ResourceRequests + from ._models_py3 import ResourceSku + from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection + from ._models_py3 import ResourceSkuLocationInfo + from ._models_py3 import ResourceSkuRestrictionInfo + from ._models_py3 import ResourceSkuRestrictions + from ._models_py3 import ResourceSkuZoneDetails + from ._models_py3 import ResourceUploadDefinition + from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import SkuCapacity + from ._models_py3 import StorageAccount + from ._models_py3 import StorageProperties + from ._models_py3 import StorageResource + from ._models_py3 import StorageResourceCollection + from ._models_py3 import SupportedRuntimeVersion + from ._models_py3 import SystemData + from ._models_py3 import TemporaryDisk + from ._models_py3 import TestKeys + from ._models_py3 import TrackedResource + from ._models_py3 import UserSourceInfo +except (SyntaxError, ImportError): + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import ApplicationInsightsAgentVersions # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import AzureFileVolume # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import ContentCertificateProperties # type: ignore + from ._models import CustomContainer # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import CustomPersistentDiskProperties # type: ignore + from ._models import CustomPersistentDiskResource # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import DeploymentSettingsContainerProbeSettings # type: ignore + from ._models import DiagnosticParameters # type: ignore + from ._models import Error # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import ImageRegistryCredential # type: ignore + from ._models import KeyVaultCertificateProperties # type: ignore + from ._models import LoadedCertificate # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceRequests # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import StorageAccount # type: ignore + from ._models import StorageProperties # type: ignore + from ._models import StorageResource # type: ignore + from ._models import StorageResourceCollection # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import SystemData # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import UserSourceInfo # type: ignore from ._app_platform_management_client_enums import ( - ActionType, AppResourceProvisioningState, ConfigServerState, CreatedByType, @@ -108,12 +193,10 @@ ResourceSkuRestrictionsType, RuntimeVersion, SkuScaleType, - StorageType, SupportedRuntimePlatform, SupportedRuntimeValue, TestKeyType, TrafficDirection, - Type, UserSourceType, ) @@ -203,7 +286,6 @@ 'TestKeys', 'TrackedResource', 'UserSourceInfo', - 'ActionType', 'AppResourceProvisioningState', 'ConfigServerState', 'CreatedByType', @@ -217,11 +299,9 @@ 'ResourceSkuRestrictionsType', 'RuntimeVersion', 'SkuScaleType', - 'StorageType', 'SupportedRuntimePlatform', 'SupportedRuntimeValue', 'TestKeyType', 'TrafficDirection', - 'Type', 'UserSourceType', ] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py index 8a48df4eabc..4f163172137 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_app_platform_management_client_enums.py @@ -6,18 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) - INTERNAL = "Internal" -class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -26,7 +35,7 @@ class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, CREATING = "Creating" UPDATING = "Updating" -class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -36,7 +45,7 @@ class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -45,7 +54,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -54,7 +63,7 @@ class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ @@ -66,7 +75,7 @@ class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum UPGRADING = "Upgrading" COMPILING = "Compiling" -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -75,7 +84,7 @@ class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -84,21 +93,19 @@ class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class PowerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PowerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Power state of the Service """ RUNNING = "Running" STOPPED = "Stopped" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ CREATING = "Creating" UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" DELETING = "Deleting" DELETED = "Deleted" SUCCEEDED = "Succeeded" @@ -107,7 +114,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -115,14 +122,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class RuntimeVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Runtime version """ @@ -130,7 +137,7 @@ class RuntimeVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -138,20 +145,14 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the storage. - """ - - STORAGE_ACCOUNT = "StorageAccount" - -class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -159,27 +160,21 @@ class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA11 = "Java_11" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the underlying resource to mount as a persistent disk. - """ - - AZURE_FILE_VOLUME = "AzureFileVolume" - -class UserSourceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class UserSourceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the source uploaded """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py index a3645379c04..630434ecd0f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/models/_models_py3.py @@ -35,8 +35,6 @@ def __init__( self, **kwargs ): - """ - """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -70,8 +68,6 @@ def __init__( self, **kwargs ): - """ - """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -107,8 +103,6 @@ def __init__( self, **kwargs ): - """ - """ super(ProxyResource, self).__init__(**kwargs) @@ -123,12 +117,12 @@ class AppResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties - :ivar location: The GEO location of the application, always the same with its parent resource. - :vartype location: str + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. + :type location: str """ _validation = { @@ -154,16 +148,6 @@ def __init__( location: Optional[str] = None, **kwargs ): - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -173,11 +157,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of App resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -192,13 +176,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -209,33 +186,33 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar public: Indicates whether the App exposes public endpoint. - :vartype public: bool + :param public: Indicates whether the App exposes public endpoint. + :type public: bool :ivar url: URL of the App. :vartype url: str :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceProvisioningState - :ivar active_deployment_name: Name of the active deployment of the App. - :vartype active_deployment_name: str - :ivar fqdn: Fully qualified dns Name. - :vartype fqdn: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool + :param active_deployment_name: Name of the active deployment of the App. + :type active_deployment_name: str + :param fqdn: Fully qualified dns Name. + :type fqdn: str + :param https_only: Indicate if only https is allowed. + :type https_only: bool :ivar created_time: Date time when the resource is created. :vartype created_time: ~datetime.datetime - :ivar temporary_disk: Temporary disk settings. - :vartype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk + :param custom_persistent_disks: List of custom persistent disks. + :type custom_persistent_disks: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] - :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :vartype enable_end_to_end_tls: bool - :ivar loaded_certificates: Collection of loaded certificates. - :vartype loaded_certificates: + :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :type enable_end_to_end_tls: bool + :param loaded_certificates: Collection of loaded certificates. + :type loaded_certificates: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] """ @@ -274,28 +251,6 @@ def __init__( loaded_certificates: Optional[List["LoadedCertificate"]] = None, **kwargs ): - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword active_deployment_name: Name of the active deployment of the App. - :paramtype active_deployment_name: str - :keyword fqdn: Fully qualified dns Name. - :paramtype fqdn: str - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword temporary_disk: Temporary disk settings. - :paramtype temporary_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2021_09_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskResource] - :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :paramtype enable_end_to_end_tls: bool - :keyword loaded_certificates: Collection of loaded certificates. - :paramtype loaded_certificates: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LoadedCertificate] - """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -314,11 +269,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -333,13 +288,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDetail] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -367,8 +315,6 @@ def __init__( self, **kwargs ): - """ - """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -381,15 +327,15 @@ class CustomPersistentDiskProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.Type - :ivar mount_path: Required. The mount path of the persistent disk. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] + :param type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :type type: str + :param mount_path: Required. The mount path of the persistent disk. + :type mount_path: str + :param read_only: Indicates whether the persistent disk is a readOnly one. + :type read_only: bool + :param mount_options: These are the mount options for a persistent disk. + :type mount_options: list[str] """ _validation = { @@ -416,14 +362,6 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): - """ - :keyword mount_path: Required. The mount path of the persistent disk. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ super(CustomPersistentDiskProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.mount_path = mount_path @@ -436,17 +374,17 @@ class AzureFileVolume(CustomPersistentDiskProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.Type - :ivar mount_path: Required. The mount path of the persistent disk. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: Required. The share name of the Azure File share. - :vartype share_name: str + :param type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :type type: str + :param mount_path: Required. The mount path of the persistent disk. + :type mount_path: str + :param read_only: Indicates whether the persistent disk is a readOnly one. + :type read_only: bool + :param mount_options: These are the mount options for a persistent disk. + :type mount_options: list[str] + :param share_name: Required. The share name of the Azure File share. + :type share_name: str """ _validation = { @@ -472,16 +410,6 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): - """ - :keyword mount_path: Required. The mount path of the persistent disk. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: Required. The share name of the Azure File share. - :paramtype share_name: str - """ super(AzureFileVolume, self).__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) self.type = 'AzureFileVolume' # type: str self.share_name = share_name @@ -498,9 +426,8 @@ class BindingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties """ _validation = { @@ -522,11 +449,6 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceProperties - """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -534,11 +456,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :ivar value: Collection of Binding resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -553,13 +475,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -574,12 +489,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :ivar resource_id: The Azure resource id of the bound resource. - :vartype resource_id: str - :ivar key: The key of the bound resource. - :vartype key: str - :ivar binding_parameters: Binding parameters of the Binding resource. - :vartype binding_parameters: dict[str, any] + :param resource_id: The Azure resource id of the bound resource. + :type resource_id: str + :param key: The key of the bound resource. + :type key: str + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -616,14 +531,6 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): - """ - :keyword resource_id: The Azure resource id of the bound resource. - :paramtype resource_id: str - :keyword key: The key of the bound resource. - :paramtype key: str - :keyword binding_parameters: Binding parameters of the Binding resource. - :paramtype binding_parameters: dict[str, any] - """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -645,8 +552,8 @@ class CertificateProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str + :param type: Required. The type of the certificate source.Constant filled by server. + :type type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -693,8 +600,6 @@ def __init__( self, **kwargs ): - """ - """ super(CertificateProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.thumbprint = None @@ -717,8 +622,8 @@ class CertificateResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties """ _validation = { @@ -740,10 +645,6 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateProperties - """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -751,10 +652,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :ivar value: The certificate resources list. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :ivar next_link: The link to next page of certificate list. - :vartype next_link: str + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { @@ -769,12 +670,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -783,17 +678,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + :param code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in + :type message: str + :param target: The target of the particular error. For example, the name of the property in error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -812,19 +707,6 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CloudErrorBody] - """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -838,12 +720,12 @@ class ClusterResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Provisioning state of the Service. Possible values include: - "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", - "Moving", "Moved", "MoveFailed". + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. @@ -873,10 +755,6 @@ def __init__( network_profile: Optional["NetworkProfile"] = None, **kwargs ): - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfile - """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -890,27 +768,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar repositories: Repositories of git. - :vartype repositories: + :param repositories: Repositories of git. + :type repositories: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -945,29 +823,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.GitPatternRepository] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -990,10 +845,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + :param error: Error when apply config server settings. + :type error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :param config_server: Settings of config server. + :type config_server: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings """ _validation = { @@ -1013,13 +868,6 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings - """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -1037,8 +885,8 @@ class ConfigServerResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties """ _validation = { @@ -1060,11 +908,6 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerProperties - """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -1072,9 +915,8 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty + :param git_property: Property of git environment. + :type git_property: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -1087,11 +929,6 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerGitProperty - """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -1099,12 +936,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :ivar name: The name of the config server settings error record. - :vartype name: str - :ivar uri: The uri of the config server settings error record. - :vartype uri: str - :ivar messages: The detail error messages of the record. - :vartype messages: list[str] + :param name: The name of the config server settings error record. + :type name: str + :param uri: The uri of the config server settings error record. + :type uri: str + :param messages: The detail error messages of the record. + :type messages: list[str] """ _attribute_map = { @@ -1121,14 +958,6 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): - """ - :keyword name: The name of the config server settings error record. - :paramtype name: str - :keyword uri: The uri of the config server settings error record. - :paramtype uri: str - :keyword messages: The detail error messages of the record. - :paramtype messages: list[str] - """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -1138,10 +967,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :ivar is_valid: Indicate if the config server settings are valid. - :vartype is_valid: bool - :ivar details: The detail validation results. - :vartype details: + :param is_valid: Indicate if the config server settings are valid. + :type is_valid: bool + :param details: The detail validation results. + :type details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -1157,13 +986,6 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): - """ - :keyword is_valid: Indicate if the config server settings are valid. - :paramtype is_valid: bool - :keyword details: The detail validation results. - :paramtype details: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsErrorRecord] - """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -1176,8 +998,8 @@ class ContentCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str + :param type: Required. The type of the certificate source.Constant filled by server. + :type type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -1192,8 +1014,8 @@ class ContentCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :ivar content: The content of uploaded certificate. - :vartype content: str + :param content: Required. The content of uploaded certificate. + :type content: str """ _validation = { @@ -1205,6 +1027,7 @@ class ContentCertificateProperties(CertificateProperties): 'activate_date': {'readonly': True}, 'subject_name': {'readonly': True}, 'dns_names': {'readonly': True}, + 'content': {'required': True}, } _attribute_map = { @@ -1222,13 +1045,9 @@ class ContentCertificateProperties(CertificateProperties): def __init__( self, *, - content: Optional[str] = None, + content: str, **kwargs ): - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ super(ContentCertificateProperties, self).__init__(**kwargs) self.type = 'ContentCertificate' # type: str self.content = content @@ -1237,19 +1056,19 @@ def __init__( class CustomContainer(msrest.serialization.Model): """Custom container payload. - :ivar server: The name of the registry that contains the container image. - :vartype server: str - :ivar container_image: Container image of the custom container. This should be in the form of + :param server: The name of the registry that contains the container image. + :type server: str + :param container_image: Container image of the custom container. This should be in the form of :code:``::code:`` without the server name of the registry. - :vartype container_image: str - :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + :type container_image: str + :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. - :vartype command: list[str] - :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not + :type command: list[str] + :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not provided. - :vartype args: list[str] - :ivar image_registry_credential: Credential of the image registry. - :vartype image_registry_credential: + :type args: list[str] + :param image_registry_credential: Credential of the image registry. + :type image_registry_credential: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ImageRegistryCredential """ @@ -1271,22 +1090,6 @@ def __init__( image_registry_credential: Optional["ImageRegistryCredential"] = None, **kwargs ): - """ - :keyword server: The name of the registry that contains the container image. - :paramtype server: str - :keyword container_image: Container image of the custom container. This should be in the form - of :code:``::code:`` without the server name of the registry. - :paramtype container_image: str - :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT - is used if this is not provided. - :paramtype command: list[str] - :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not - provided. - :paramtype args: list[str] - :keyword image_registry_credential: Credential of the image registry. - :paramtype image_registry_credential: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ImageRegistryCredential - """ super(CustomContainer, self).__init__(**kwargs) self.server = server self.container_image = container_image @@ -1300,12 +1103,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str + :param thumbprint: The thumbprint of bound certificate. + :type thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :ivar cert_name: The bound certificate name of domain. - :vartype cert_name: str + :param cert_name: The bound certificate name of domain. + :type cert_name: str """ _validation = { @@ -1325,12 +1128,6 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -1348,8 +1145,8 @@ class CustomDomainResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties + :param properties: Properties of the custom domain resource. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties """ _validation = { @@ -1371,11 +1168,6 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainProperties - """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -1383,10 +1175,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :ivar value: The custom domain resources list. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :ivar next_link: The link to next page of custom domain list. - :vartype next_link: str + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str """ _attribute_map = { @@ -1401,12 +1193,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1417,8 +1203,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name to be validated. - :vartype name: str + :param name: Required. Name to be validated. + :type name: str """ _validation = { @@ -1435,10 +1221,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword name: Required. Name to be validated. - :paramtype name: str - """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -1446,10 +1228,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :ivar is_valid: Indicates if domain name is valid. - :vartype is_valid: bool - :ivar message: Message of why domain name is invalid. - :vartype message: str + :param is_valid: Indicates if domain name is valid. + :type is_valid: bool + :param message: Message of why domain name is invalid. + :type message: str """ _attribute_map = { @@ -1464,12 +1246,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword is_valid: Indicates if domain name is valid. - :paramtype is_valid: bool - :keyword message: Message of why domain name is invalid. - :paramtype message: str - """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -1480,12 +1256,12 @@ class CustomPersistentDiskResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource + :param custom_persistent_disk_properties: Properties of the custom persistent disk resource payload. - :vartype custom_persistent_disk_properties: + :type custom_persistent_disk_properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: Required. The resource id of Azure Spring Cloud Storage resource. - :vartype storage_id: str + :param storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :type storage_id: str """ _validation = { @@ -1504,14 +1280,6 @@ def __init__( custom_persistent_disk_properties: Optional["CustomPersistentDiskProperties"] = None, **kwargs ): - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: Required. The resource id of Azure Spring Cloud Storage resource. - :paramtype storage_id: str - """ super(CustomPersistentDiskResource, self).__init__(**kwargs) self.custom_persistent_disk_properties = custom_persistent_disk_properties self.storage_id = storage_id @@ -1554,8 +1322,6 @@ def __init__( self, **kwargs ): - """ - """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -1575,11 +1341,11 @@ class DeploymentResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Deployment resource. - :vartype properties: + :param properties: Properties of the Deployment resource. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + :param sku: Sku of the Deployment resource. + :type sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku """ _validation = { @@ -1603,13 +1369,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku - """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -1618,11 +1377,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of Deployment resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1637,13 +1396,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1654,12 +1406,12 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar source: Uploaded source information of the deployment. - :vartype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo + :param source: Uploaded source information of the deployment. + :type source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo :ivar app_name: App name of the deployment. :vartype app_name: str - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: + :param deployment_settings: Deployment settings of the Deployment. + :type deployment_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -1704,13 +1456,6 @@ def __init__( deployment_settings: Optional["DeploymentSettings"] = None, **kwargs ): - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettings - """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.app_name = None @@ -1725,30 +1470,29 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :ivar cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard + :param cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard tier. This is deprecated starting from API version 2021-09-01-preview. Please use the resourceRequests field to set the CPU size. - :vartype cpu: int - :ivar memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, + :type cpu: int + :param memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version 2021-09-01-preview. Please use the resourceRequests field to set the the memory size. - :vartype memory_in_gb: int - :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is + :type memory_in_gb: int + :param resource_requests: The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. - :vartype resource_requests: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. - :vartype net_core_main_entry_path: str - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", + :type resource_requests: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests + :param jvm_options: JVM parameter. + :type jvm_options: str + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. + :type net_core_main_entry_path: str + :param environment_variables: Collection of environment variables. + :type environment_variables: dict[str, str] + :param runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", "NetCore_31". Default value: "Java_8". - :vartype runtime_version: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: + :type runtime_version: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion + :param container_probe_settings: Container liveness and readiness probe settings. + :type container_probe_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings """ @@ -1776,34 +1520,6 @@ def __init__( container_probe_settings: Optional["DeploymentSettingsContainerProbeSettings"] = None, **kwargs ): - """ - :keyword cpu: Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard - tier. This is deprecated starting from API version 2021-09-01-preview. Please use the - resourceRequests field to set the CPU size. - :paramtype cpu: int - :keyword memory_in_gb: Required Memory size in GB. This should be in range [1, 2] for Basic - tier, and in range [1, 8] for Standard tier. This is deprecated starting from API version - 2021-09-01-preview. Please use the resourceRequests field to set the the memory size. - :paramtype memory_in_gb: int - :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceRequests - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. - :paramtype net_core_main_entry_path: str - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword runtime_version: Runtime version. Possible values include: "Java_8", "Java_11", - "NetCore_31". Default value: "Java_8". - :paramtype runtime_version: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RuntimeVersion - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentSettingsContainerProbeSettings - """ super(DeploymentSettings, self).__init__(**kwargs) self.cpu = cpu self.memory_in_gb = memory_in_gb @@ -1818,8 +1534,8 @@ def __init__( class DeploymentSettingsContainerProbeSettings(msrest.serialization.Model): """Container liveness and readiness probe settings. - :ivar disable_probe: Indicates whether disable the liveness and readiness probe. - :vartype disable_probe: bool + :param disable_probe: Indicates whether disable the liveness and readiness probe. + :type disable_probe: bool """ _attribute_map = { @@ -1832,10 +1548,6 @@ def __init__( disable_probe: Optional[bool] = None, **kwargs ): - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ super(DeploymentSettingsContainerProbeSettings, self).__init__(**kwargs) self.disable_probe = disable_probe @@ -1843,12 +1555,12 @@ def __init__( class DiagnosticParameters(msrest.serialization.Model): """Diagnostic parameters of diagnostic operations. - :ivar app_instance: App instance name. - :vartype app_instance: str - :ivar file_path: Your target file path in your own BYOS. - :vartype file_path: str - :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :vartype duration: str + :param app_instance: App instance name. + :type app_instance: str + :param file_path: Your target file path in your own BYOS. + :type file_path: str + :param duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :type duration: str """ _attribute_map = { @@ -1865,14 +1577,6 @@ def __init__( duration: Optional[str] = None, **kwargs ): - """ - :keyword app_instance: App instance name. - :paramtype app_instance: str - :keyword file_path: Your target file path in your own BYOS. - :paramtype file_path: str - :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :paramtype duration: str - """ super(DiagnosticParameters, self).__init__(**kwargs) self.app_instance = app_instance self.file_path = file_path @@ -1882,10 +1586,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :ivar code: The code of error. - :vartype code: str - :ivar message: The message of error. - :vartype message: str + :param code: The code of error. + :type code: str + :param message: The message of error. + :type message: str """ _attribute_map = { @@ -1900,12 +1604,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -1916,28 +1614,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param name: Required. Name of the repository. + :type name: str + :param pattern: Collection of pattern of the repository. + :type pattern: list[str] + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -1975,30 +1673,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -2016,10 +1690,10 @@ def __init__( class ImageRegistryCredential(msrest.serialization.Model): """Credential of the image registry. - :ivar username: The username of the image registry credential. - :vartype username: str - :ivar password: The password of the image registry credential. - :vartype password: str + :param username: The username of the image registry credential. + :type username: str + :param password: The password of the image registry credential. + :type password: str """ _attribute_map = { @@ -2034,12 +1708,6 @@ def __init__( password: Optional[str] = None, **kwargs ): - """ - :keyword username: The username of the image registry credential. - :paramtype username: str - :keyword password: The password of the image registry credential. - :paramtype password: str - """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = username self.password = password @@ -2052,8 +1720,8 @@ class KeyVaultCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str + :param type: Required. The type of the certificate source.Constant filled by server. + :type type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -2068,15 +1736,15 @@ class KeyVaultCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :ivar vault_uri: Required. The vault uri of user key vault. - :vartype vault_uri: str - :ivar key_vault_cert_name: Required. The certificate name of key vault. - :vartype key_vault_cert_name: str - :ivar cert_version: The certificate version of key vault. - :vartype cert_version: str - :ivar exclude_private_key: Optional. If set to true, it will not import private key from key + :param vault_uri: Required. The vault uri of user key vault. + :type vault_uri: str + :param key_vault_cert_name: Required. The certificate name of key vault. + :type key_vault_cert_name: str + :param cert_version: The certificate version of key vault. + :type cert_version: str + :param exclude_private_key: Optional. If set to true, it will not import private key from key vault. - :vartype exclude_private_key: bool + :type exclude_private_key: bool """ _validation = { @@ -2116,17 +1784,6 @@ def __init__( exclude_private_key: Optional[bool] = False, **kwargs ): - """ - :keyword vault_uri: Required. The vault uri of user key vault. - :paramtype vault_uri: str - :keyword key_vault_cert_name: Required. The certificate name of key vault. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - :keyword exclude_private_key: Optional. If set to true, it will not import private key from key - vault. - :paramtype exclude_private_key: bool - """ super(KeyVaultCertificateProperties, self).__init__(**kwargs) self.type = 'KeyVaultCertificate' # type: str self.vault_uri = vault_uri @@ -2140,11 +1797,11 @@ class LoadedCertificate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Resource Id of loaded certificate. - :vartype resource_id: str - :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust + :param resource_id: Required. Resource Id of loaded certificate. + :type resource_id: str + :param load_trust_store: Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. - :vartype load_trust_store: bool + :type load_trust_store: bool """ _validation = { @@ -2163,13 +1820,6 @@ def __init__( load_trust_store: Optional[bool] = False, **kwargs ): - """ - :keyword resource_id: Required. Resource Id of loaded certificate. - :paramtype resource_id: str - :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust - store, only work for Java runtime. - :paramtype load_trust_store: bool - """ super(LoadedCertificate, self).__init__(**kwargs) self.resource_id = resource_id self.load_trust_store = load_trust_store @@ -2180,8 +1830,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar url: Required. URL of the log file. - :vartype url: str + :param url: Required. URL of the log file. + :type url: str """ _validation = { @@ -2198,10 +1848,6 @@ def __init__( url: str, **kwargs ): - """ - :keyword url: Required. URL of the log file. - :paramtype url: str - """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -2209,12 +1855,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str """ _attribute_map = { @@ -2231,14 +1877,6 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2248,13 +1886,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id. - :vartype principal_id: str - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str + :type type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. + :type principal_id: str + :param tenant_id: Tenant Id. + :type tenant_id: str """ _attribute_map = { @@ -2271,15 +1909,6 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): - """ - :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -2289,13 +1918,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :param name: Name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :vartype to_be_exported_for_shoebox: bool + :type to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -2312,15 +1941,6 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :paramtype to_be_exported_for_shoebox: bool - """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2330,31 +1950,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: Unit that makes sense for the metric. + :type unit: str + :param category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :type category: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :type aggregation_type: str + :param supported_aggregation_types: Supported aggregation types. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: Supported time grain types. + :type supported_time_grain_types: list[str] + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] - :ivar source_mdm_namespace: Name of the MDM namespace. Optional. - :vartype source_mdm_namespace: str + :type fill_gap_with_zero: bool + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] + :param source_mdm_namespace: Name of the MDM namespace. Optional. + :type source_mdm_namespace: str """ _attribute_map = { @@ -2387,33 +2007,6 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2437,20 +2030,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error - :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated - since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate - if monitoringSettings enabled or not. - :vartype trace_enabled: bool - :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or - whitespace include empty will disable monitoringSettings. - :vartype app_insights_instrumentation_key: str - :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :param error: Error when apply Monitoring Setting changes. + :type error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :type trace_enabled: bool + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :type app_insights_instrumentation_key: str + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :vartype app_insights_sampling_rate: float - :ivar app_insights_agent_versions: Indicates the versions of application insight agent. - :vartype app_insights_agent_versions: + :type app_insights_sampling_rate: float + :param app_insights_agent_versions: Indicates the versions of application insight agent. + :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions """ @@ -2478,23 +2071,6 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Error - :keyword trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :paramtype trace_enabled: bool - :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :paramtype app_insights_instrumentation_key: str - :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :paramtype app_insights_sampling_rate: float - :keyword app_insights_agent_versions: Indicates the versions of application insight agent. - :paramtype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ApplicationInsightsAgentVersions - """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -2515,8 +2091,8 @@ class MonitoringSettingResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: + :param properties: Properties of the Monitoring Setting resource. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties """ @@ -2539,11 +2115,6 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingProperties - """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -2551,12 +2122,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: Reason why the name is not available. - :vartype reason: str - :ivar message: Message why the name is not available. - :vartype message: str + :param name_available: Indicates whether the name is available. + :type name_available: bool + :param reason: Reason why the name is not available. + :type reason: str + :param message: Message why the name is not available. + :type message: str """ _attribute_map = { @@ -2573,14 +2144,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword name_available: Indicates whether the name is available. - :paramtype name_available: bool - :keyword reason: Reason why the name is not available. - :paramtype reason: str - :keyword message: Message why the name is not available. - :paramtype message: str - """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -2592,10 +2155,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the resource to check name availability. - :vartype type: str - :ivar name: Required. Name to be checked. - :vartype name: str + :param type: Required. Type of the resource to check name availability. + :type type: str + :param name: Required. Name to be checked. + :type name: str """ _validation = { @@ -2615,12 +2178,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword type: Required. Type of the resource to check name availability. - :paramtype type: str - :keyword name: Required. Name to be checked. - :paramtype name: str - """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -2631,19 +2188,20 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring - Cloud Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Cloud service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :type service_runtime_subnet_id: str + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :type app_subnet_id: str + :param service_cidr: Azure Spring Cloud service reserved CIDR. + :type service_cidr: str + :param service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources of + :type service_runtime_network_resource_group: str + :param app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :vartype app_network_resource_group: str + :type app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NetworkProfileOutboundIPs @@ -2677,22 +2235,6 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Cloud service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Cloud Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :paramtype app_network_resource_group: str - """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -2724,8 +2266,6 @@ def __init__( self, **kwargs ): - """ - """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -2733,32 +2273,22 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - Variables are only populated by the server, and will be ignored when sending a request. - - :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.appplatform.v2021_09_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties """ - _validation = { - 'action_type': {'readonly': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -2773,23 +2303,10 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): - """ - :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.appplatform.v2021_09_01_preview.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.OperationProperties - """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display - self.action_type = None self.origin = origin self.properties = properties @@ -2797,14 +2314,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :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 + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Resource of the operation. + :type resource: str + :param operation: Localized friendly name for the operation. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str """ _attribute_map = { @@ -2823,16 +2340,6 @@ def __init__( description: Optional[str] = None, **kwargs ): - """ - :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2843,8 +2350,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification """ @@ -2858,11 +2365,6 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceSpecification - """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2872,12 +2374,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar size_in_gb: Size of the persistent disk in GB. - :vartype size_in_gb: int + :param size_in_gb: Size of the persistent disk in GB. + :type size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :ivar mount_path: Mount path of the persistent disk. - :vartype mount_path: str + :param mount_path: Mount path of the persistent disk. + :type mount_path: str """ _validation = { @@ -2898,12 +2400,6 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): - """ - :keyword size_in_gb: Size of the persistent disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the persistent disk. - :paramtype mount_path: str - """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -2915,9 +2411,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + :param key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType + :type key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType """ _validation = { @@ -2934,11 +2430,6 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): - """ - :keyword key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeyType - """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -2981,8 +2472,6 @@ def __init__( self, **kwargs ): - """ - """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -2994,12 +2483,12 @@ def __init__( class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :vartype cpu: str - :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, - 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :vartype memory: str + :type cpu: str + :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :type memory: str """ _attribute_map = { @@ -3014,14 +2503,6 @@ def __init__( memory: Optional[str] = None, **kwargs ): - """ - :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 - for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :paramtype cpu: str - :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :paramtype memory: str - """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -3030,23 +2511,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :ivar resource_type: Gets the type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: Gets the name of SKU. - :vartype name: str - :ivar tier: Gets the tier of SKU. - :vartype tier: str - :ivar capacity: Gets the capacity of SKU. - :vartype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity - :ivar locations: Gets the set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Gets a list of locations and availability zones in those locations where + :param resource_type: Gets the type of resource the SKU applies to. + :type resource_type: str + :param name: Gets the name of SKU. + :type name: str + :param tier: Gets the tier of SKU. + :type tier: str + :param capacity: Gets the capacity of SKU. + :type capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity + :param locations: Gets the set of locations that the SKU is available. + :type locations: list[str] + :param location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :vartype location_info: + :type location_info: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] - :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :vartype restrictions: + :type restrictions: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] """ @@ -3072,26 +2553,6 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): - """ - :keyword resource_type: Gets the type of resource the SKU applies to. - :paramtype resource_type: str - :keyword name: Gets the name of SKU. - :paramtype name: str - :keyword tier: Gets the tier of SKU. - :paramtype tier: str - :keyword capacity: Gets the capacity of SKU. - :paramtype capacity: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuCapacity - :keyword locations: Gets the set of locations that the SKU is available. - :paramtype locations: list[str] - :keyword location_info: Gets a list of locations and availability zones in those locations - where the SKU is available. - :paramtype location_info: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuLocationInfo] - :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :paramtype restrictions: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictions] - """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -3105,10 +2566,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :ivar name: Gets an invariant to describe the feature. - :vartype name: str - :ivar value: Gets an invariant if the feature is measured by quantity. - :vartype value: str + :param name: Gets an invariant to describe the feature. + :type name: str + :param value: Gets an invariant if the feature is measured by quantity. + :type value: str """ _attribute_map = { @@ -3123,12 +2584,6 @@ def __init__( value: Optional[str] = None, **kwargs ): - """ - :keyword name: Gets an invariant to describe the feature. - :paramtype name: str - :keyword value: Gets an invariant if the feature is measured by quantity. - :paramtype value: str - """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -3137,11 +2592,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -3156,13 +2611,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSku] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3171,12 +2619,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :ivar location: Gets location of the SKU. - :vartype location: str - :ivar zones: Gets list of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. - :vartype zone_details: + :param location: Gets location of the SKU. + :type location: str + :param zones: Gets list of availability zones where the SKU is supported. + :type zones: list[str] + :param zone_details: Gets details of capabilities available to a SKU in specific zones. + :type zone_details: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] """ @@ -3194,15 +2642,6 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): - """ - :keyword location: Gets location of the SKU. - :paramtype location: str - :keyword zones: Gets list of availability zones where the SKU is supported. - :paramtype zones: list[str] - :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. - :paramtype zone_details: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuZoneDetails] - """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -3212,10 +2651,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :ivar locations: Gets locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: Gets list of availability zones where the SKU is restricted. - :vartype zones: list[str] + :param locations: Gets locations where the SKU is restricted. + :type locations: list[str] + :param zones: Gets list of availability zones where the SKU is restricted. + :type zones: list[str] """ _attribute_map = { @@ -3230,12 +2669,6 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): - """ - :keyword locations: Gets locations where the SKU is restricted. - :paramtype locations: list[str] - :keyword zones: Gets list of availability zones where the SKU is restricted. - :paramtype zones: list[str] - """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -3244,21 +2677,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :vartype type: str or + :type type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType - :ivar values: Gets the value of restrictions. If the restriction type is set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + :type values: list[str] + :param restriction_info: Gets the information about the restriction where the SKU cannot be used. - :vartype restriction_info: + :type restriction_info: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or + :type reason_code: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -3278,24 +2711,6 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsType - :keyword values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :paramtype values: list[str] - :keyword restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :paramtype restriction_info: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuRestrictionsReasonCode - """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -3306,12 +2721,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :ivar name: Gets the set of zones that the SKU is available in with the + :param name: Gets the set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + :type name: list[str] + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :vartype capabilities: + :type capabilities: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] """ @@ -3327,15 +2742,6 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): - """ - :keyword name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :paramtype name: list[str] - :keyword capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :paramtype capabilities: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCapabilities] - """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -3344,10 +2750,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :ivar relative_path: Source relative path. - :vartype relative_path: str - :ivar upload_url: Upload URL. - :vartype upload_url: str + :param relative_path: Source relative path. + :type relative_path: str + :param upload_url: Upload URL. + :type upload_url: str """ _attribute_map = { @@ -3362,12 +2768,6 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -3384,11 +2784,11 @@ class TrackedResource(Resource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] """ _validation = { @@ -3412,13 +2812,6 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -3435,16 +2828,15 @@ class ServiceResource(TrackedResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the Service resource. - :vartype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. + :type sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku """ _validation = { @@ -3472,18 +2864,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the Service resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2021_09_01_preview.models.Sku - """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -3492,11 +2872,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :ivar value: Collection of Service resources. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -3511,13 +2891,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3526,11 +2899,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] """ @@ -3546,14 +2919,6 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2021_09_01_preview.models.MetricSpecification] - """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -3562,12 +2927,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :ivar name: Name of the Sku. - :vartype name: str - :ivar tier: Tier of the Sku. - :vartype tier: str - :ivar capacity: Current capacity of the target resource. - :vartype capacity: int + :param name: Name of the Sku. + :type name: str + :param tier: Tier of the Sku. + :type tier: str + :param capacity: Current capacity of the target resource. + :type capacity: int """ _attribute_map = { @@ -3584,14 +2949,6 @@ def __init__( capacity: Optional[int] = None, **kwargs ): - """ - :keyword name: Name of the Sku. - :paramtype name: str - :keyword tier: Tier of the Sku. - :paramtype tier: str - :keyword capacity: Current capacity of the target resource. - :paramtype capacity: int - """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -3603,15 +2960,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar minimum: Required. Gets or sets the minimum. - :vartype minimum: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar default: Gets or sets the default. - :vartype default: int - :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + :param minimum: Required. Gets or sets the minimum. + :type minimum: int + :param maximum: Gets or sets the maximum. + :type maximum: int + :param default: Gets or sets the default. + :type default: int + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType + :type scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType """ _validation = { @@ -3634,17 +2991,6 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): - """ - :keyword minimum: Required. Gets or sets the minimum. - :paramtype minimum: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword default: Gets or sets the default. - :paramtype default: int - :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SkuScaleType - """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -3660,9 +3006,8 @@ class StorageProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageType + :param storage_type: Required. The type of the storage.Constant filled by server. + :type storage_type: str """ _validation = { @@ -3681,8 +3026,6 @@ def __init__( self, **kwargs ): - """ - """ super(StorageProperties, self).__init__(**kwargs) self.storage_type = None # type: Optional[str] @@ -3692,13 +3035,12 @@ class StorageAccount(StorageProperties): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageType - :ivar account_name: Required. The account name of the Azure Storage Account. - :vartype account_name: str - :ivar account_key: Required. The account key of the Azure Storage Account. - :vartype account_key: str + :param storage_type: Required. The type of the storage.Constant filled by server. + :type storage_type: str + :param account_name: Required. The account name of the Azure Storage Account. + :type account_name: str + :param account_key: Required. The account key of the Azure Storage Account. + :type account_key: str """ _validation = { @@ -3720,12 +3062,6 @@ def __init__( account_key: str, **kwargs ): - """ - :keyword account_name: Required. The account name of the Azure Storage Account. - :paramtype account_name: str - :keyword account_key: Required. The account key of the Azure Storage Account. - :paramtype account_key: str - """ super(StorageAccount, self).__init__(**kwargs) self.storage_type = 'StorageAccount' # type: str self.account_name = account_name @@ -3743,8 +3079,8 @@ class StorageResource(ProxyResource): :vartype name: str :ivar type: The type of the resource. :vartype type: str - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties + :param properties: Properties of the storage resource payload. + :type properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2021_09_01_preview.models.SystemData """ @@ -3770,10 +3106,6 @@ def __init__( properties: Optional["StorageProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageProperties - """ super(StorageResource, self).__init__(**kwargs) self.properties = properties self.system_data = None @@ -3782,10 +3114,10 @@ def __init__( class StorageResourceCollection(msrest.serialization.Model): """Collection compose of storage resources list and a possible link for next page. - :ivar value: The storage resources list. - :vartype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str + :param value: The storage resources list. + :type value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :param next_link: The link to next page of storage list. + :type next_link: str """ _attribute_map = { @@ -3800,12 +3132,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ super(StorageResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3814,15 +3140,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values - include: "Java_8", "Java_11", "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :vartype platform: str or + :type platform: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform - :ivar version: The detailed version (major.minor) of the platform. - :vartype version: str + :param version: The detailed version (major.minor) of the platform. + :type version: str """ _attribute_map = { @@ -3839,18 +3165,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -3860,22 +3174,21 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: - "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or + :type last_modified_by_type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3898,24 +3211,6 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3928,10 +3223,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :ivar size_in_gb: Size of the temporary disk in GB. - :vartype size_in_gb: int - :ivar mount_path: Mount path of the temporary disk. - :vartype mount_path: str + :param size_in_gb: Size of the temporary disk in GB. + :type size_in_gb: int + :param mount_path: Mount path of the temporary disk. + :type mount_path: str """ _validation = { @@ -3950,12 +3245,6 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): - """ - :keyword size_in_gb: Size of the temporary disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the temporary disk. - :paramtype mount_path: str - """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -3964,16 +3253,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :ivar primary_key: Primary key. - :vartype primary_key: str - :ivar secondary_key: Secondary key. - :vartype secondary_key: str - :ivar primary_test_endpoint: Primary test endpoint. - :vartype primary_test_endpoint: str - :ivar secondary_test_endpoint: Secondary test endpoint. - :vartype secondary_test_endpoint: str - :ivar enabled: Indicates whether the test endpoint feature enabled or not. - :vartype enabled: bool + :param primary_key: Primary key. + :type primary_key: str + :param secondary_key: Secondary key. + :type secondary_key: str + :param primary_test_endpoint: Primary test endpoint. + :type primary_test_endpoint: str + :param secondary_test_endpoint: Secondary test endpoint. + :type secondary_test_endpoint: str + :param enabled: Indicates whether the test endpoint feature enabled or not. + :type enabled: bool """ _attribute_map = { @@ -3994,18 +3283,6 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): - """ - :keyword primary_key: Primary key. - :paramtype primary_key: str - :keyword secondary_key: Secondary key. - :paramtype secondary_key: str - :keyword primary_test_endpoint: Primary test endpoint. - :paramtype primary_test_endpoint: str - :keyword secondary_test_endpoint: Secondary test endpoint. - :paramtype secondary_test_endpoint: str - :keyword enabled: Indicates whether the test endpoint feature enabled or not. - :paramtype enabled: bool - """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -4017,19 +3294,19 @@ def __init__( class UserSourceInfo(msrest.serialization.Model): """Source information for a deployment. - :ivar type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", + :param type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", "Source", "Container". - :vartype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar version: Version of the source. - :vartype version: str - :ivar artifact_selector: Selector for the artifact to be used for the deployment for + :type type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str + :param version: Version of the source. + :type version: str + :param artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :vartype artifact_selector: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer + :type artifact_selector: str + :param custom_container: Custom container payload. + :type custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer """ _attribute_map = { @@ -4050,21 +3327,6 @@ def __init__( custom_container: Optional["CustomContainer"] = None, **kwargs ): - """ - :keyword type: Type of the source uploaded. Possible values include: "Jar", "NetCoreZip", - "Source", "Container". - :paramtype type: str or ~azure.mgmt.appplatform.v2021_09_01_preview.models.UserSourceType - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword version: Version of the source. - :paramtype version: str - :keyword artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :paramtype artifact_selector: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomContainer - """ super(UserSourceInfo, self).__init__(**kwargs) self.type = type self.relative_path = relative_path diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py index 3a98683cb52..9252b1716cd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,319 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. @@ -342,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -360,7 +65,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -372,27 +77,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,47 +114,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -465,19 +177,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -491,20 +201,14 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -518,22 +222,28 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -543,42 +253,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -588,17 +302,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -610,17 +323,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -633,18 +343,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -654,47 +371,52 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -711,19 +433,17 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -737,20 +457,14 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -764,22 +478,28 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -789,17 +509,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.AppResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -808,48 +528,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -858,11 +575,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -871,20 +584,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace def get_resource_upload_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -904,26 +616,29 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -936,19 +651,17 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace def validate_domain( self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -959,8 +672,7 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainValidateResult @@ -971,30 +683,34 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1007,6 +723,4 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py index 8c7a874dc79..2203d1097fe 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.BindingResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py index 8c74b0b7123..909a09e8360 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,185 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. @@ -208,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -235,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -327,19 +172,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> LROPoller["_models.CertificateResource"]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -350,24 +193,17 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -381,22 +217,28 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,42 +248,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -451,17 +297,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -473,17 +318,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -496,18 +338,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -517,17 +366,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.CertificateResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -536,48 +385,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +432,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +441,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py index fa97da75ec5..da944554e83 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,194 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -217,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -241,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -327,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -347,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -377,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -402,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -457,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -477,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -507,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -532,45 +364,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -587,18 +424,16 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace def begin_validate( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -607,24 +442,17 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -637,22 +465,27 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -662,6 +495,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py index f43ae67ea77..7c95c48d105 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py index 22380901934..0075a59821e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,591 +5,27 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_cluster_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restart_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_log_file_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_generate_heap_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_generate_thread_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_start_jfr_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class DeploymentsOperations(object): # pylint: disable=too-many-public-methods + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations(object): """DeploymentsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -612,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -642,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -675,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -737,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -763,24 +202,17 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -795,22 +227,29 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -820,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -867,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -892,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -916,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -937,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -996,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1022,24 +472,17 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -1054,22 +497,29 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1079,19 +529,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1101,55 +551,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1158,11 +604,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1171,20 +613,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1192,53 +633,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1247,11 +685,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1260,46 +694,49 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1309,18 +746,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1334,17 +770,14 @@ def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1358,18 +791,26 @@ def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1379,44 +820,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1426,18 +871,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1451,17 +895,14 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1475,18 +916,26 @@ def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1496,44 +945,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1543,18 +996,17 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements + def begin_restart( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1568,17 +1020,14 @@ def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1592,18 +1041,26 @@ def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1613,19 +1070,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - @distributed_trace def get_log_file_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1647,27 +1104,30 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1682,49 +1142,52 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + def _generate_heap_dump_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_heap_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1734,19 +1197,18 @@ def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - @distributed_trace - def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + def begin_generate_heap_dump( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Generate Heap Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1759,22 +1221,17 @@ def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1789,19 +1246,26 @@ def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1811,49 +1275,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + def _generate_thread_dump_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_thread_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1863,19 +1332,18 @@ def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - - @distributed_trace - def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + def begin_generate_thread_dump( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Generate Thread Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1888,22 +1356,17 @@ def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statement :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1918,19 +1381,26 @@ def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statement app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1940,49 +1410,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + def _start_jfr_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._start_jfr_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1992,19 +1467,18 @@ def _start_jfr_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore + _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore - - @distributed_trace - def begin_start_jfr( # pylint: disable=inconsistent-return-statements + def begin_start_jfr( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start JFR. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -2017,22 +1491,17 @@ def begin_start_jfr( # pylint: disable=inconsistent-return-statements :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2047,19 +1516,26 @@ def begin_start_jfr( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2069,6 +1545,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py index 268cadda312..4b2214f6802 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,150 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -173,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -197,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -283,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -303,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -333,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -358,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -413,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -433,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -463,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -488,6 +364,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py index ca281fa37d2..9f101fb7be3 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,50 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. @@ -73,49 +45,47 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +94,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,8 +103,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py index 77be28c973b..a3f7d1e885c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,49 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_runtime_versions_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -72,11 +44,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list_runtime_versions( self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -89,22 +61,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,6 +89,4 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py index a3277b6014e..4cbd1bb4a23 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,519 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_test_keys_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_test_key_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_disable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_enable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. @@ -542,13 +47,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -566,25 +71,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -597,45 +105,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -655,18 +166,16 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -678,20 +187,14 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -704,22 +207,27 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,40 +237,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -772,16 +284,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -791,17 +302,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -813,18 +321,24 @@ def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -834,45 +348,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -889,18 +408,16 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -912,20 +429,14 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -938,22 +449,27 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -963,17 +479,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace def list_test_keys( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -991,25 +507,28 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1022,18 +541,16 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace def regenerate_test_key( self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1042,8 +559,7 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2021_09_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.TestKeys @@ -1054,29 +570,33 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1089,17 +609,15 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + def disable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1117,25 +635,28 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1145,16 +666,15 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - - @distributed_trace def enable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1172,25 +692,28 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1203,40 +726,42 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1246,16 +771,15 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1265,17 +789,14 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1287,18 +808,24 @@ def begin_stop( # pylint: disable=inconsistent-return-statements raw_result = self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1308,40 +835,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1351,16 +882,15 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1370,17 +900,14 @@ def begin_start( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1392,18 +919,24 @@ def begin_start( # pylint: disable=inconsistent-return-statements raw_result = self._start_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1413,24 +946,23 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - @distributed_trace def check_name_availability( self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2021_09_01_preview.models.NameAvailability @@ -1441,28 +973,32 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1475,55 +1011,53 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1532,11 +1066,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1545,18 +1075,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1564,44 +1093,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1610,11 +1138,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1623,8 +1147,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py index 171bbd6fa20..03bebe5f0bf 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,56 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. @@ -79,52 +45,51 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.ResourceSkuCollection"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,11 +98,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -146,8 +107,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py index d3fc54c14be..6752237e796 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/operations/_storages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,185 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class StoragesOperations(object): """StoragesOperations operations. @@ -208,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> "_models.StorageResource": + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.StorageResource" """Get the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -235,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> "_models.StorageResource": + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + storage_resource, # type: "_models.StorageResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.StorageResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(storage_resource, 'StorageResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2021-09-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(storage_resource, 'StorageResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -327,19 +172,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> LROPoller["_models.StorageResource"]: + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + storage_resource, # type: "_models.StorageResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.StorageResource"] """Create or update storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -353,20 +196,14 @@ def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either StorageResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -380,22 +217,28 @@ def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -405,42 +248,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -450,17 +297,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -472,17 +318,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -495,18 +338,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -516,17 +366,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.StorageResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StorageResourceCollection"] """List all the storages of one Azure Spring Cloud instance. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -535,48 +385,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2021_09_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-09-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("StorageResourceCollection", pipeline_response) + deserialized = self._deserialize('StorageResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -585,11 +432,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -598,8 +441,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py index 41ec6d71ff7..d2ddf950056 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/__init__.py @@ -12,7 +12,8 @@ __version__ = VERSION __all__ = ['AppPlatformManagementClient'] -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py index 4633ae192d4..075f127a8de 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_app_platform_management_client.py @@ -6,51 +6,66 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import ConfigurationServicesOperations +from .operations import ServiceRegistriesOperations +from .operations import BuildServiceOperations +from .operations import BuildpackBindingOperations +from .operations import BuildServiceBuilderOperations +from .operations import BuildServiceAgentPoolOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import StoragesOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .operations import GatewaysOperations +from .operations import GatewayRouteConfigsOperations +from .operations import GatewayCustomDomainsOperations +from .operations import ApiPortalsOperations +from .operations import ApiPortalCustomDomainsOperations +from . import models + -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2022_01_01_preview.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigServersOperations :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigurationServicesOperations + :vartype configuration_services: azure.mgmt.appplatform.v2022_01_01_preview.operations.ConfigurationServicesOperations :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_01_01_preview.operations.ServiceRegistriesOperations + :vartype service_registries: azure.mgmt.appplatform.v2022_01_01_preview.operations.ServiceRegistriesOperations :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceOperations + :vartype build_service: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceOperations :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildpackBindingOperations + :vartype buildpack_binding: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildpackBindingOperations :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceBuilderOperations + :vartype build_service_builder: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceBuilderOperations :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceAgentPoolOperations + :vartype build_service_agent_pool: azure.mgmt.appplatform.v2022_01_01_preview.operations.BuildServiceAgentPoolOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_01_01_preview.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2022_01_01_preview.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2022_01_01_preview.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -58,113 +73,117 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2022_01_01_preview.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_01_01_preview.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2022_01_01_preview.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_01_01_preview.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_01_01_preview.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2022_01_01_preview.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2022_01_01_preview.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_01_01_preview.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2022_01_01_preview.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2022_01_01_preview.operations.SkusOperations :ivar gateways: GatewaysOperations operations :vartype gateways: azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewaysOperations :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayRouteConfigsOperations + :vartype gateway_route_configs: azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayRouteConfigsOperations :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayCustomDomainsOperations + :vartype gateway_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.operations.GatewayCustomDomainsOperations :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalsOperations + :vartype api_portals: azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalsOperations :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalCustomDomainsOperations + :vartype api_portal_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.operations.ApiPortalCustomDomainsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - + self._deserialize = Deserializer(client_models) - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations( + self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.gateways = GatewaysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse + :rtype: ~azure.core.pipeline.transport.HttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response def close(self): # type: () -> None diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py index 62fe7927765..307ac0800d9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_configuration.py @@ -6,20 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from typing import Any + from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,31 +29,26 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2022-01-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -71,4 +68,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py index 44ce4a5043f..39f10548873 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/__init__.py @@ -8,8 +8,3 @@ from ._app_platform_management_client import AppPlatformManagementClient __all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py index 1a8e1445d17..27b48307eb5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_app_platform_management_client.py @@ -6,51 +6,64 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING -from msrest import Deserializer, Serializer - -from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations +from msrest import Deserializer, Serializer if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +from ._configuration import AppPlatformManagementClientConfiguration +from .operations import ServicesOperations +from .operations import ConfigServersOperations +from .operations import ConfigurationServicesOperations +from .operations import ServiceRegistriesOperations +from .operations import BuildServiceOperations +from .operations import BuildpackBindingOperations +from .operations import BuildServiceBuilderOperations +from .operations import BuildServiceAgentPoolOperations +from .operations import MonitoringSettingsOperations +from .operations import AppsOperations +from .operations import BindingsOperations +from .operations import StoragesOperations +from .operations import CertificatesOperations +from .operations import CustomDomainsOperations +from .operations import DeploymentsOperations +from .operations import Operations +from .operations import RuntimeVersionsOperations +from .operations import SkusOperations +from .operations import GatewaysOperations +from .operations import GatewayRouteConfigsOperations +from .operations import GatewayCustomDomainsOperations +from .operations import ApiPortalsOperations +from .operations import ApiPortalCustomDomainsOperations +from .. import models + + +class AppPlatformManagementClient(object): """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations :vartype services: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ServicesOperations :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigServersOperations + :vartype config_servers: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigServersOperations :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigurationServicesOperations + :vartype configuration_services: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ConfigurationServicesOperations :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ServiceRegistriesOperations + :vartype service_registries: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ServiceRegistriesOperations :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceOperations + :vartype build_service: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceOperations :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildpackBindingOperations + :vartype buildpack_binding: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildpackBindingOperations :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceBuilderOperations + :vartype build_service_builder: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceBuilderOperations :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceAgentPoolOperations + :vartype build_service_agent_pool: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.BuildServiceAgentPoolOperations :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.MonitoringSettingsOperations + :vartype monitoring_settings: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.MonitoringSettingsOperations :ivar apps: AppsOperations operations :vartype apps: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.AppsOperations :ivar bindings: BindingsOperations operations @@ -58,113 +71,115 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :ivar storages: StoragesOperations operations :vartype storages: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.StoragesOperations :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CertificatesOperations + :vartype certificates: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CertificatesOperations :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CustomDomainsOperations + :vartype custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.CustomDomainsOperations :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.DeploymentsOperations + :vartype deployments: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.DeploymentsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.Operations :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.RuntimeVersionsOperations + :vartype runtime_versions: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.RuntimeVersionsOperations :ivar skus: SkusOperations operations :vartype skus: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.SkusOperations :ivar gateways: GatewaysOperations operations :vartype gateways: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewaysOperations :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayRouteConfigsOperations + :vartype gateway_route_configs: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayRouteConfigsOperations :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayCustomDomainsOperations + :vartype gateway_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.GatewayCustomDomainsOperations :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalsOperations + :vartype api_portals: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalsOperations :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations + :vartype api_portal_custom_domains: azure.mgmt.appplatform.v2022_01_01_preview.aio.operations.ApiPortalCustomDomainsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + if not base_url: + base_url = 'https://management.azure.com' + self._config = AppPlatformManagementClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - + self._deserialize = Deserializer(client_models) - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.config_servers = ConfigServersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.configuration_services = ConfigurationServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.service_registries = ServiceRegistriesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.build_service = BuildServiceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.buildpack_binding = BuildpackBindingOperations( + self._client, self._config, self._serialize, self._deserialize) + self.build_service_builder = BuildServiceBuilderOperations( + self._client, self._config, self._serialize, self._deserialize) + self.build_service_agent_pool = BuildServiceAgentPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + self.monitoring_settings = MonitoringSettingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.apps = AppsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.bindings = BindingsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.storages = StoragesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.custom_domains = CustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.runtime_versions = RuntimeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.skus = SkusOperations( + self._client, self._config, self._serialize, self._deserialize) + self.gateways = GatewaysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.gateway_route_configs = GatewayRouteConfigsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.gateway_custom_domains = GatewayCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.api_portals = ApiPortalsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.api_portal_custom_domains = ApiPortalCustomDomainsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response async def close(self) -> None: await self._client.close() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py index 7b9398e3372..8f5510ed6e0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,12 +27,8 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-01-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -41,17 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") + super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2022-01-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) @@ -70,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py index 2147a0e1dea..ed4c82d6888 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portal_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._api_portal_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,11 +169,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -196,24 +193,17 @@ async def begin_create_or_update( :type domain_name: str :param api_portal_custom_domain_resource: The API portal custom domain for the create or update operation. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :type api_portal_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( @@ -228,22 +218,29 @@ async def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -253,11 +250,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -270,27 +267,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -300,11 +300,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -325,17 +323,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -349,18 +344,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -370,11 +373,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -392,50 +394,46 @@ def list( :param api_portal_name: The name of API portal. :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('ApiPortalCustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -444,11 +442,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -457,8 +451,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py index 86e7e4d35b4..486f62751c0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_api_portals_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._api_portals_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(api_portal_resource, 'ApiPortalResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,11 +163,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,20 +186,14 @@ async def begin_create_or_update( :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( @@ -216,22 +207,28 @@ async def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +238,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -257,26 +254,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -286,11 +286,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -308,17 +306,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -331,18 +326,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -352,11 +354,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -371,48 +372,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] + :return: An iterator like instance of either ApiPortalResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) + deserialized = self._deserialize('ApiPortalResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +419,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,13 +428,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore - @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -459,8 +451,7 @@ async def validate_domain( :param api_portal_name: The name of API portal. :type api_portal_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -471,30 +462,34 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -507,6 +502,4 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py index d1acb17b8fd..3f338481215 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_set_active_deployments_request_initial, build_update_request_initial, build_validate_domain_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -65,7 +60,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -77,27 +72,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +109,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _create_or_update_initial( self, @@ -127,30 +124,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -170,11 +171,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -196,20 +194,14 @@ async def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -223,22 +215,28 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -248,11 +246,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -264,26 +262,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -293,11 +294,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -315,17 +314,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -338,18 +334,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -359,9 +362,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _update_initial( self, @@ -376,30 +379,34 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -416,11 +423,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -442,20 +446,14 @@ async def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -469,22 +467,28 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -494,11 +498,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace def list( self, resource_group_name: str, @@ -513,48 +516,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -563,11 +563,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -576,13 +572,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -609,26 +603,29 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,9 +638,7 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore async def _set_active_deployments_initial( self, @@ -658,30 +653,34 @@ async def _set_active_deployments_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - - request = build_set_active_deployments_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._set_active_deployments_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._set_active_deployments_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -698,11 +697,8 @@ async def _set_active_deployments_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - - @distributed_trace_async async def begin_set_active_deployments( self, resource_group_name: str, @@ -721,24 +717,17 @@ async def begin_set_active_deployments( :param app_name: The name of the App resource. :type app_name: str :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection + :type active_deployment_collection: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -752,22 +741,28 @@ async def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -777,11 +772,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -800,8 +794,7 @@ async def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -812,30 +805,34 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -848,6 +845,4 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py index 028f51b987f..9fad4251796 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py index 05fa4b953ae..f60cf408b53 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_agent_pool_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_agent_pool_operations import build_get_request, build_list_request, build_update_put_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, resource_group_name: str, @@ -65,50 +60,46 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) + deserialized = self._deserialize('BuildServiceAgentPoolResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,11 +108,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,13 +117,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore - @distributed_trace_async async def get( self, resource_group_name: str, @@ -166,27 +151,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -199,9 +187,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore async def _update_put_initial( self, @@ -209,7 +195,7 @@ async def _update_put_initial( service_name: str, build_service_name: str, agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", + pool_size: "_models.BuildServiceAgentPoolSizeProperties", **kwargs: Any ) -> "_models.BuildServiceAgentPoolResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] @@ -217,31 +203,35 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(pool_size, 'BuildServiceAgentPoolSizeProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -258,18 +248,15 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, service_name: str, build_service_name: str, agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", + pool_size: "_models.BuildServiceAgentPoolSizeProperties", **kwargs: Any ) -> AsyncLROPoller["_models.BuildServiceAgentPoolResource"]: """Create or update build service agent pool. @@ -283,25 +270,18 @@ async def begin_update_put( :type build_service_name: str :param agent_pool_name: The name of the build service agent pool resource. :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource + :param pool_size: Parameters for the update operation. + :type pool_size: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( @@ -315,23 +295,30 @@ async def begin_update_put( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - agent_pool_resource=agent_pool_resource, - api_version=api_version, - content_type=content_type, + pool_size=pool_size, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -341,6 +328,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py index e7c8a2a7c5f..465b350940c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_builder_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_builder_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(builder_resource, 'BuilderResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(builder_resource, 'BuilderResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,11 +169,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,20 +195,14 @@ async def begin_create_or_update( :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( @@ -226,22 +217,29 @@ async def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BuilderResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -251,11 +249,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -268,27 +266,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -298,11 +299,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -323,17 +322,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -347,18 +343,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -368,11 +372,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -390,50 +393,46 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] + :return: An iterator like instance of either BuilderResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) + deserialized = self._deserialize('BuilderResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -442,11 +441,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -455,8 +450,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py index 8184e9aa40d..3b2f70331b8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_build_service_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_operations import build_create_or_update_build_request, build_get_build_request, build_get_build_result_log_request, build_get_build_result_request, build_get_build_service_request, build_get_resource_upload_url_request, build_get_supported_buildpack_request, build_get_supported_stack_request, build_list_build_results_request, build_list_build_services_request, build_list_builds_request, build_list_supported_buildpacks_request, build_list_supported_stacks_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list_build_services( self, resource_group_name: str, @@ -60,48 +55,45 @@ def list_build_services( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] + :return: An iterator like instance of either BuildServiceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_build_services.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_build_services.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceCollection", pipeline_response) + deserialized = self._deserialize('BuildServiceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,11 +102,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -123,13 +111,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore - @distributed_trace_async async def get_build_service( self, resource_group_name: str, @@ -156,26 +142,29 @@ async def get_build_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_build_service_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_build_service.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -188,11 +177,8 @@ async def get_build_service( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore - - - @distributed_trace def list_builds( self, resource_group_name: str, @@ -211,48 +197,45 @@ def list_builds( :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_builds.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_builds.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) + deserialized = self._deserialize('BuildCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -261,11 +244,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,13 +253,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore - @distributed_trace_async async def get_build( self, resource_group_name: str, @@ -310,27 +287,30 @@ async def get_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.get_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -343,11 +323,8 @@ async def get_build( return cls(pipeline_response, deserialized, {}) return deserialized + get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace_async async def create_or_update_build( self, resource_group_name: str, @@ -380,31 +357,35 @@ async def create_or_update_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(build, 'Build') - - request = build_create_or_update_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_build.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(build, 'Build') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -421,11 +402,8 @@ async def create_or_update_build( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace def list_build_results( self, resource_group_name: str, @@ -446,52 +424,47 @@ def list_build_results( :param build_name: The name of the build resource. :type build_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] + :return: An iterator like instance of either BuildResultCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.list_build_results.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_build_results.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildResultCollection", pipeline_response) + deserialized = self._deserialize('BuildResultCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -500,11 +473,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -513,13 +482,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore - @distributed_trace_async async def get_build_result( self, resource_group_name: str, @@ -552,28 +519,31 @@ async def get_build_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build_result.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_build_result_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -586,11 +556,8 @@ async def get_build_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore - - - @distributed_trace_async async def get_build_result_log( self, resource_group_name: str, @@ -623,28 +590,31 @@ async def get_build_result_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build_result_log.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_build_result_log_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result_log.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -657,11 +627,8 @@ async def get_build_result_log( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore - - - @distributed_trace_async async def get_resource_upload_url( self, resource_group_name: str, @@ -688,26 +655,29 @@ async def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -720,11 +690,8 @@ async def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace_async async def list_supported_buildpacks( self, resource_group_name: str, @@ -751,26 +718,29 @@ async def list_supported_buildpacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_supported_buildpacks.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_supported_buildpacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_buildpacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -783,11 +753,8 @@ async def list_supported_buildpacks( return cls(pipeline_response, deserialized, {}) return deserialized + list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore - - - @distributed_trace_async async def get_supported_buildpack( self, resource_group_name: str, @@ -817,27 +784,30 @@ async def get_supported_buildpack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_supported_buildpack.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildpackName': self._serialize.url("buildpack_name", buildpack_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_supported_buildpack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - api_version=api_version, - template_url=self.get_supported_buildpack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -850,11 +820,8 @@ async def get_supported_buildpack( return cls(pipeline_response, deserialized, {}) return deserialized + get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore - - - @distributed_trace_async async def list_supported_stacks( self, resource_group_name: str, @@ -881,26 +848,29 @@ async def list_supported_stacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_supported_stacks.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_supported_stacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_stacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -913,11 +883,8 @@ async def list_supported_stacks( return cls(pipeline_response, deserialized, {}) return deserialized + list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore - - - @distributed_trace_async async def get_supported_stack( self, resource_group_name: str, @@ -947,27 +914,30 @@ async def get_supported_stack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_supported_stack.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'stackName': self._serialize.url("stack_name", stack_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_supported_stack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - api_version=api_version, - template_url=self.get_supported_stack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -980,6 +950,4 @@ async def get_supported_stack( return cls(pipeline_response, deserialized, {}) return deserialized - - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore - + get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py index 36bce4599b0..46c7730c901 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_buildpack_binding_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._buildpack_binding_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -80,28 +75,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -114,9 +112,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore async def _create_or_update_initial( self, @@ -133,32 +129,36 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -175,11 +175,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -204,24 +201,17 @@ async def begin_create_or_update( :param buildpack_binding_name: The name of the Buildpack Binding Name. :type buildpack_binding_name: str :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :type buildpack_binding: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( @@ -237,22 +227,30 @@ async def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -262,11 +260,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -280,28 +278,31 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -311,11 +312,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -339,17 +338,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type buildpack_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -364,18 +360,27 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -385,11 +390,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -410,52 +414,47 @@ def list( :param builder_name: The name of the builder resource. :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BuildpackBindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -464,11 +463,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -477,8 +472,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py index bf472f84902..7d289ba0f53 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,11 +166,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,24 +186,17 @@ async def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -220,22 +210,28 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -245,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -261,26 +257,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -290,11 +289,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -312,17 +309,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -335,18 +329,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -356,11 +357,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -375,48 +375,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,11 +422,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,8 +431,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py index ab5eceaefae..8401332e3fd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,9 +355,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _validate_initial( self, @@ -376,29 +371,33 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -415,11 +414,8 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -435,24 +431,17 @@ async def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -465,22 +454,27 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,6 +484,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py index 6532d671e0f..0d447012151 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_configuration_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._configuration_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,11 +163,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -187,24 +184,17 @@ async def begin_create_or_update( :param configuration_service_name: The name of Application Configuration Service. :type configuration_service_name: str :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :type configuration_service_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( @@ -218,22 +208,28 @@ async def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -243,11 +239,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -259,26 +255,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -288,11 +287,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -310,17 +307,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type configuration_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -333,18 +327,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -354,11 +355,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - @distributed_trace def list( self, resource_group_name: str, @@ -373,48 +373,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) + deserialized = self._deserialize('ConfigurationServiceResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -423,11 +420,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -436,11 +429,10 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore async def _validate_initial( self, @@ -455,30 +447,34 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(settings, 'ConfigurationServiceSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(settings, 'ConfigurationServiceSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -495,11 +491,8 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore - - - @distributed_trace_async async def begin_validate( self, resource_group_name: str, @@ -521,20 +514,14 @@ async def begin_validate( :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( @@ -548,22 +535,28 @@ async def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -573,6 +566,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py index adf270af6db..9e9f5ad6ab2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,20 +198,14 @@ async def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -229,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _update_initial( self, @@ -389,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -430,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -459,20 +464,14 @@ async def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -487,22 +486,29 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -512,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -534,50 +539,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +587,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +596,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py index 07637f590ba..0a1fa32f738 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,26 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DeploymentsOperations: # pylint: disable=too-many-public-methods +class DeploymentsOperations: """DeploymentsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -172,11 +172,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,24 +195,17 @@ async def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -230,22 +220,29 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -255,11 +252,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -272,27 +269,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,11 +302,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -327,17 +325,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -351,18 +346,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,9 +375,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _update_initial( self, @@ -390,31 +393,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -431,11 +438,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -457,24 +461,17 @@ async def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -489,22 +486,29 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -514,11 +518,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -536,55 +539,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -593,11 +592,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -606,13 +601,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, resource_group_name: str, @@ -627,53 +620,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -682,11 +672,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -695,13 +681,12 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -714,27 +699,30 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -744,11 +732,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -769,17 +755,14 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -793,18 +776,26 @@ async def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -814,11 +805,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -831,27 +822,30 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -861,11 +855,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -886,17 +878,14 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -910,18 +899,26 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -931,11 +928,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, service_name: str, @@ -948,27 +945,30 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,11 +978,9 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements + async def begin_restart( self, resource_group_name: str, service_name: str, @@ -1003,17 +1001,14 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1027,18 +1022,26 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1048,11 +1051,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - @distributed_trace_async async def get_log_file_url( self, resource_group_name: str, @@ -1082,27 +1084,30 @@ async def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1117,11 +1122,9 @@ async def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + async def _generate_heap_dump_initial( self, resource_group_name: str, service_name: str, @@ -1135,31 +1138,35 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_heap_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1169,11 +1176,9 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - - @distributed_trace_async - async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + async def begin_generate_heap_dump( self, resource_group_name: str, service_name: str, @@ -1194,22 +1199,17 @@ async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-state :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1224,19 +1224,26 @@ async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-state app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1246,11 +1253,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + async def _generate_thread_dump_initial( self, resource_group_name: str, service_name: str, @@ -1264,31 +1271,35 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_thread_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1298,11 +1309,9 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - @distributed_trace_async - async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + async def begin_generate_thread_dump( self, resource_group_name: str, service_name: str, @@ -1323,22 +1332,17 @@ async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-sta :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1353,19 +1357,26 @@ async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-sta app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1375,11 +1386,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + async def _start_jfr_initial( self, resource_group_name: str, service_name: str, @@ -1393,31 +1404,35 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._start_jfr_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1427,11 +1442,9 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore - - @distributed_trace_async - async def begin_start_jfr( # pylint: disable=inconsistent-return-statements + async def begin_start_jfr( self, resource_group_name: str, service_name: str, @@ -1452,22 +1465,17 @@ async def begin_start_jfr( # pylint: disable=inconsistent-return-statements :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1482,19 +1490,26 @@ async def begin_start_jfr( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1504,6 +1519,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py index bda4b0a1ea0..a16058f20a3 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._gateway_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,11 +169,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -196,24 +193,17 @@ async def begin_create_or_update( :type domain_name: str :param gateway_custom_domain_resource: The gateway custom domain resource for the create or update operation. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :type gateway_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( @@ -228,22 +218,29 @@ async def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -253,11 +250,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -270,27 +267,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -300,11 +300,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -325,17 +323,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -349,18 +344,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -370,11 +373,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -392,50 +394,46 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('GatewayCustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -444,11 +442,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -457,8 +451,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py index e50ce43897d..879835a5a33 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateway_route_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._gateway_route_configs_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -77,27 +72,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,9 +108,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore async def _create_or_update_initial( self, @@ -128,31 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -169,11 +169,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -197,24 +194,17 @@ async def begin_create_or_update( :type route_config_name: str :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or update operation. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :type gateway_route_config_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( @@ -229,22 +219,29 @@ async def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,11 +251,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,27 +268,30 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +301,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -326,17 +324,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type route_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -350,18 +345,26 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,11 +374,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -393,50 +395,46 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) + deserialized = self._deserialize('GatewayRouteConfigResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -445,11 +443,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -458,8 +452,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py index 6a07fd9f990..c6a16f88f9c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_gateways_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._gateways_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_resource, 'GatewayResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(gateway_resource, 'GatewayResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -163,11 +163,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -189,20 +186,14 @@ async def begin_create_or_update( :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( @@ -216,22 +207,28 @@ async def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GatewayResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -241,11 +238,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -257,26 +254,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -286,11 +286,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -308,17 +306,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -331,18 +326,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -352,11 +354,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -371,48 +372,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] + :return: An iterator like instance of either GatewayResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) + deserialized = self._deserialize('GatewayResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,11 +419,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,13 +428,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore - @distributed_trace_async async def validate_domain( self, resource_group_name: str, @@ -459,8 +451,7 @@ async def validate_domain( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -471,30 +462,34 @@ async def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -507,6 +502,4 @@ async def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py index 3598039f413..4b9dc1db8fb 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,25 +65,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,9 +99,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_put_initial( self, @@ -116,29 +113,33 @@ async def _update_put_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -155,11 +156,8 @@ async def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_put( self, resource_group_name: str, @@ -175,24 +173,17 @@ async def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -205,22 +196,27 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,9 +226,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_patch_initial( self, @@ -246,29 +242,33 @@ async def _update_patch_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -285,11 +285,8 @@ async def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async async def begin_update_patch( self, resource_group_name: str, @@ -305,24 +302,17 @@ async def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -335,22 +325,27 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -360,6 +355,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py index c91fe0675ca..abbd206c94e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -53,40 +49,38 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,11 +89,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,8 +98,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py index d2534b0635f..65d60cb0677 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,18 +5,16 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._runtime_versions_operations import build_list_runtime_versions_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def list_runtime_versions( self, **kwargs: Any @@ -60,22 +56,22 @@ async def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -88,6 +84,4 @@ async def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py index 7345418874b..f160fa212ba 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_service_registries_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._service_registries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore async def _create_or_update_initial( self, @@ -122,26 +118,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -158,11 +157,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -181,19 +177,14 @@ async def begin_create_or_update( :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( @@ -206,21 +197,28 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,11 +228,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -246,26 +244,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -275,11 +276,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -297,17 +296,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -320,18 +316,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -341,11 +344,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - @distributed_trace def list( self, resource_group_name: str, @@ -360,48 +362,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) + deserialized = self._deserialize('ServiceRegistryResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -410,11 +409,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -423,8 +418,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py index ad5a79c8524..bde4f4bf318 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -71,25 +66,28 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,9 +100,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _create_or_update_initial( self, @@ -118,29 +114,33 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -160,11 +160,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -183,20 +180,14 @@ async def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -209,22 +200,27 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -234,11 +230,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -249,25 +245,28 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -277,11 +276,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -296,17 +293,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -318,18 +312,24 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -339,9 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _update_initial( self, @@ -355,29 +355,33 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -394,11 +398,8 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,20 +418,14 @@ async def begin_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -443,22 +438,27 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -468,11 +468,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace_async async def list_test_keys( self, resource_group_name: str, @@ -496,25 +495,28 @@ async def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -527,11 +529,8 @@ async def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace_async async def regenerate_test_key( self, resource_group_name: str, @@ -547,8 +546,7 @@ async def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys @@ -559,29 +557,33 @@ async def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -594,12 +596,9 @@ async def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + async def disable_test_endpoint( self, resource_group_name: str, service_name: str, @@ -622,25 +621,28 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -650,10 +652,8 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - @distributed_trace_async async def enable_test_endpoint( self, resource_group_name: str, @@ -677,25 +677,28 @@ async def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -708,11 +711,9 @@ async def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -723,25 +724,28 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -751,11 +755,9 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -770,17 +772,14 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -792,18 +791,24 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements raw_result = await self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -813,11 +818,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -828,25 +833,28 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -856,11 +864,9 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -875,17 +881,14 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -897,18 +900,24 @@ async def begin_start( # pylint: disable=inconsistent-return-statements raw_result = await self._start_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -918,11 +927,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - - @distributed_trace_async async def check_name_availability( self, location: str, @@ -934,8 +942,7 @@ async def check_name_availability( :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability @@ -946,28 +953,32 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -980,11 +991,8 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -993,42 +1001,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1037,11 +1045,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1050,13 +1054,11 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -1069,44 +1071,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1115,11 +1116,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1128,8 +1125,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py index 2d4863be299..b577ccb270a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,19 +5,17 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -44,7 +41,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace def list( self, **kwargs: Any @@ -52,44 +48,43 @@ def list( """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,11 +93,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,8 +102,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py index e0e602f6d27..37643ae075c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/operations/_storages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,22 +5,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request -from ...operations._storages_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request + T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +43,6 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,26 +69,29 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,9 +104,7 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore async def _create_or_update_initial( self, @@ -123,30 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(storage_resource, 'StorageResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(storage_resource, 'StorageResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -166,11 +166,8 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -192,20 +189,14 @@ async def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either StorageResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -219,22 +210,28 @@ async def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -244,11 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -260,26 +257,29 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,11 +289,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -311,17 +309,14 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -334,18 +329,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -355,11 +357,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace def list( self, resource_group_name: str, @@ -374,48 +375,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request async def extract_data(pipeline_response): - deserialized = self._deserialize("StorageResourceCollection", pipeline_response) + deserialized = self._deserialize('StorageResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -424,11 +422,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -437,8 +431,7 @@ async def get_next(next_link=None): return pipeline_response - return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py index 70cda27f9ac..89a09924b4b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/__init__.py @@ -6,176 +6,342 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import ActiveDeploymentCollection -from ._models_py3 import ApiPortalCustomDomainProperties -from ._models_py3 import ApiPortalCustomDomainResource -from ._models_py3 import ApiPortalCustomDomainResourceCollection -from ._models_py3 import ApiPortalInstance -from ._models_py3 import ApiPortalProperties -from ._models_py3 import ApiPortalResource -from ._models_py3 import ApiPortalResourceCollection -from ._models_py3 import ApiPortalResourceRequests -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import AvailableOperations -from ._models_py3 import AvailableRuntimeVersions -from ._models_py3 import AzureFileVolume -from ._models_py3 import BindingResource -from ._models_py3 import BindingResourceCollection -from ._models_py3 import BindingResourceProperties -from ._models_py3 import Build -from ._models_py3 import BuildCollection -from ._models_py3 import BuildProperties -from ._models_py3 import BuildResult -from ._models_py3 import BuildResultCollection -from ._models_py3 import BuildResultLog -from ._models_py3 import BuildResultProperties -from ._models_py3 import BuildResultUserSourceInfo -from ._models_py3 import BuildService -from ._models_py3 import BuildServiceAgentPoolProperties -from ._models_py3 import BuildServiceAgentPoolResource -from ._models_py3 import BuildServiceAgentPoolResourceCollection -from ._models_py3 import BuildServiceAgentPoolSizeProperties -from ._models_py3 import BuildServiceCollection -from ._models_py3 import BuildServiceProperties -from ._models_py3 import BuildServicePropertiesResourceRequests -from ._models_py3 import BuildStageProperties -from ._models_py3 import BuilderProperties -from ._models_py3 import BuilderResource -from ._models_py3 import BuilderResourceCollection -from ._models_py3 import BuildpackBindingLaunchProperties -from ._models_py3 import BuildpackBindingProperties -from ._models_py3 import BuildpackBindingResource -from ._models_py3 import BuildpackBindingResourceCollection -from ._models_py3 import BuildpackProperties -from ._models_py3 import BuildpacksGroupProperties -from ._models_py3 import CertificateProperties -from ._models_py3 import CertificateResource -from ._models_py3 import CertificateResourceCollection -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterResourceProperties -from ._models_py3 import ConfigServerGitProperty -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerSettings -from ._models_py3 import ConfigServerSettingsErrorRecord -from ._models_py3 import ConfigServerSettingsValidateResult -from ._models_py3 import ConfigurationServiceGitProperty -from ._models_py3 import ConfigurationServiceGitPropertyValidateResult -from ._models_py3 import ConfigurationServiceGitRepository -from ._models_py3 import ConfigurationServiceInstance -from ._models_py3 import ConfigurationServiceProperties -from ._models_py3 import ConfigurationServiceResource -from ._models_py3 import ConfigurationServiceResourceCollection -from ._models_py3 import ConfigurationServiceResourceRequests -from ._models_py3 import ConfigurationServiceSettings -from ._models_py3 import ConfigurationServiceSettingsValidateResult -from ._models_py3 import ContainerProbeSettings -from ._models_py3 import ContentCertificateProperties -from ._models_py3 import CustomContainer -from ._models_py3 import CustomContainerUserSourceInfo -from ._models_py3 import CustomDomainProperties -from ._models_py3 import CustomDomainResource -from ._models_py3 import CustomDomainResourceCollection -from ._models_py3 import CustomDomainValidatePayload -from ._models_py3 import CustomDomainValidateResult -from ._models_py3 import CustomPersistentDiskProperties -from ._models_py3 import CustomPersistentDiskResource -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import GatewayApiMetadataProperties -from ._models_py3 import GatewayApiRoute -from ._models_py3 import GatewayCorsProperties -from ._models_py3 import GatewayCustomDomainProperties -from ._models_py3 import GatewayCustomDomainResource -from ._models_py3 import GatewayCustomDomainResourceCollection -from ._models_py3 import GatewayInstance -from ._models_py3 import GatewayOperatorProperties -from ._models_py3 import GatewayOperatorResourceRequests -from ._models_py3 import GatewayProperties -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import JarUploadedUserSourceInfo -from ._models_py3 import KeyVaultCertificateProperties -from ._models_py3 import LoadedCertificate -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import MonitoringSettingProperties -from ._models_py3 import MonitoringSettingResource -from ._models_py3 import NameAvailability -from ._models_py3 import NameAvailabilityParameters -from ._models_py3 import NetCoreZipUploadedUserSourceInfo -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileOutboundIPs -from ._models_py3 import OperationDetail -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationProperties -from ._models_py3 import PersistentDisk -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RequiredTraffic -from ._models_py3 import Resource -from ._models_py3 import ResourceRequests -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuCapabilities -from ._models_py3 import ResourceSkuCollection -from ._models_py3 import ResourceSkuLocationInfo -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import ResourceSkuZoneDetails -from ._models_py3 import ResourceUploadDefinition -from ._models_py3 import ServiceRegistryInstance -from ._models_py3 import ServiceRegistryProperties -from ._models_py3 import ServiceRegistryResource -from ._models_py3 import ServiceRegistryResourceCollection -from ._models_py3 import ServiceRegistryResourceRequests -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceList -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SourceUploadedUserSourceInfo -from ._models_py3 import SsoProperties -from ._models_py3 import StackProperties -from ._models_py3 import StorageAccount -from ._models_py3 import StorageProperties -from ._models_py3 import StorageResource -from ._models_py3 import StorageResourceCollection -from ._models_py3 import SupportedBuildpackResource -from ._models_py3 import SupportedBuildpackResourceProperties -from ._models_py3 import SupportedBuildpacksCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SupportedStackResource -from ._models_py3 import SupportedStackResourceProperties -from ._models_py3 import SupportedStacksCollection -from ._models_py3 import SystemData -from ._models_py3 import TemporaryDisk -from ._models_py3 import TestKeys -from ._models_py3 import TrackedResource -from ._models_py3 import TriggeredBuildResult -from ._models_py3 import UploadedUserSourceInfo -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - +try: + from ._models_py3 import ActiveDeploymentCollection + from ._models_py3 import ApiPortalCustomDomainProperties + from ._models_py3 import ApiPortalCustomDomainResource + from ._models_py3 import ApiPortalCustomDomainResourceCollection + from ._models_py3 import ApiPortalInstance + from ._models_py3 import ApiPortalProperties + from ._models_py3 import ApiPortalResource + from ._models_py3 import ApiPortalResourceCollection + from ._models_py3 import ApiPortalResourceRequests + from ._models_py3 import AppResource + from ._models_py3 import AppResourceCollection + from ._models_py3 import AppResourceProperties + from ._models_py3 import ApplicationInsightsAgentVersions + from ._models_py3 import AvailableOperations + from ._models_py3 import AvailableRuntimeVersions + from ._models_py3 import AzureFileVolume + from ._models_py3 import BindingResource + from ._models_py3 import BindingResourceCollection + from ._models_py3 import BindingResourceProperties + from ._models_py3 import Build + from ._models_py3 import BuildCollection + from ._models_py3 import BuildProperties + from ._models_py3 import BuildResult + from ._models_py3 import BuildResultCollection + from ._models_py3 import BuildResultLog + from ._models_py3 import BuildResultProperties + from ._models_py3 import BuildResultUserSourceInfo + from ._models_py3 import BuildService + from ._models_py3 import BuildServiceAgentPoolProperties + from ._models_py3 import BuildServiceAgentPoolResource + from ._models_py3 import BuildServiceAgentPoolResourceCollection + from ._models_py3 import BuildServiceAgentPoolSizeProperties + from ._models_py3 import BuildServiceCollection + from ._models_py3 import BuildServiceProperties + from ._models_py3 import BuildServicePropertiesResourceRequests + from ._models_py3 import BuildStageProperties + from ._models_py3 import BuilderProperties + from ._models_py3 import BuilderResource + from ._models_py3 import BuilderResourceCollection + from ._models_py3 import BuildpackBindingLaunchProperties + from ._models_py3 import BuildpackBindingProperties + from ._models_py3 import BuildpackBindingResource + from ._models_py3 import BuildpackBindingResourceCollection + from ._models_py3 import BuildpackProperties + from ._models_py3 import BuildpacksGroupProperties + from ._models_py3 import CertificateProperties + from ._models_py3 import CertificateResource + from ._models_py3 import CertificateResourceCollection + from ._models_py3 import CloudErrorBody + from ._models_py3 import ClusterResourceProperties + from ._models_py3 import ConfigServerGitProperty + from ._models_py3 import ConfigServerProperties + from ._models_py3 import ConfigServerResource + from ._models_py3 import ConfigServerSettings + from ._models_py3 import ConfigServerSettingsErrorRecord + from ._models_py3 import ConfigServerSettingsValidateResult + from ._models_py3 import ConfigurationServiceGitProperty + from ._models_py3 import ConfigurationServiceGitPropertyValidateResult + from ._models_py3 import ConfigurationServiceGitRepository + from ._models_py3 import ConfigurationServiceInstance + from ._models_py3 import ConfigurationServiceProperties + from ._models_py3 import ConfigurationServiceResource + from ._models_py3 import ConfigurationServiceResourceCollection + from ._models_py3 import ConfigurationServiceResourceRequests + from ._models_py3 import ConfigurationServiceSettings + from ._models_py3 import ConfigurationServiceSettingsValidateResult + from ._models_py3 import ContainerProbeSettings + from ._models_py3 import ContentCertificateProperties + from ._models_py3 import CustomContainer + from ._models_py3 import CustomContainerUserSourceInfo + from ._models_py3 import CustomDomainProperties + from ._models_py3 import CustomDomainResource + from ._models_py3 import CustomDomainResourceCollection + from ._models_py3 import CustomDomainValidatePayload + from ._models_py3 import CustomDomainValidateResult + from ._models_py3 import CustomPersistentDiskProperties + from ._models_py3 import CustomPersistentDiskResource + from ._models_py3 import DeploymentInstance + from ._models_py3 import DeploymentResource + from ._models_py3 import DeploymentResourceCollection + from ._models_py3 import DeploymentResourceProperties + from ._models_py3 import DeploymentSettings + from ._models_py3 import DiagnosticParameters + from ._models_py3 import Error + from ._models_py3 import GatewayApiMetadataProperties + from ._models_py3 import GatewayApiRoute + from ._models_py3 import GatewayCorsProperties + from ._models_py3 import GatewayCustomDomainProperties + from ._models_py3 import GatewayCustomDomainResource + from ._models_py3 import GatewayCustomDomainResourceCollection + from ._models_py3 import GatewayInstance + from ._models_py3 import GatewayOperatorProperties + from ._models_py3 import GatewayOperatorResourceRequests + from ._models_py3 import GatewayProperties + from ._models_py3 import GatewayResource + from ._models_py3 import GatewayResourceCollection + from ._models_py3 import GatewayResourceRequests + from ._models_py3 import GatewayRouteConfigProperties + from ._models_py3 import GatewayRouteConfigResource + from ._models_py3 import GatewayRouteConfigResourceCollection + from ._models_py3 import GitPatternRepository + from ._models_py3 import ImageRegistryCredential + from ._models_py3 import JarUploadedUserSourceInfo + from ._models_py3 import KeyVaultCertificateProperties + from ._models_py3 import LoadedCertificate + from ._models_py3 import LogFileUrlResponse + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentityProperties + from ._models_py3 import MetricDimension + from ._models_py3 import MetricSpecification + from ._models_py3 import MonitoringSettingProperties + from ._models_py3 import MonitoringSettingResource + from ._models_py3 import NameAvailability + from ._models_py3 import NameAvailabilityParameters + from ._models_py3 import NetCoreZipUploadedUserSourceInfo + from ._models_py3 import NetworkProfile + from ._models_py3 import NetworkProfileOutboundIPs + from ._models_py3 import OperationDetail + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationProperties + from ._models_py3 import PersistentDisk + from ._models_py3 import ProxyResource + from ._models_py3 import RegenerateTestKeyRequestPayload + from ._models_py3 import RequiredTraffic + from ._models_py3 import Resource + from ._models_py3 import ResourceRequests + from ._models_py3 import ResourceSku + from ._models_py3 import ResourceSkuCapabilities + from ._models_py3 import ResourceSkuCollection + from ._models_py3 import ResourceSkuLocationInfo + from ._models_py3 import ResourceSkuRestrictionInfo + from ._models_py3 import ResourceSkuRestrictions + from ._models_py3 import ResourceSkuZoneDetails + from ._models_py3 import ResourceUploadDefinition + from ._models_py3 import ServiceRegistryInstance + from ._models_py3 import ServiceRegistryProperties + from ._models_py3 import ServiceRegistryResource + from ._models_py3 import ServiceRegistryResourceCollection + from ._models_py3 import ServiceRegistryResourceRequests + from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import SkuCapacity + from ._models_py3 import SourceUploadedUserSourceInfo + from ._models_py3 import SsoProperties + from ._models_py3 import StackProperties + from ._models_py3 import StorageAccount + from ._models_py3 import StorageProperties + from ._models_py3 import StorageResource + from ._models_py3 import StorageResourceCollection + from ._models_py3 import SupportedBuildpackResource + from ._models_py3 import SupportedBuildpackResourceProperties + from ._models_py3 import SupportedBuildpacksCollection + from ._models_py3 import SupportedRuntimeVersion + from ._models_py3 import SupportedStackResource + from ._models_py3 import SupportedStackResourceProperties + from ._models_py3 import SupportedStacksCollection + from ._models_py3 import SystemData + from ._models_py3 import TemporaryDisk + from ._models_py3 import TestKeys + from ._models_py3 import TrackedResource + from ._models_py3 import TriggeredBuildResult + from ._models_py3 import UploadedUserSourceInfo + from ._models_py3 import UserSourceInfo + from ._models_py3 import ValidationMessages +except (SyntaxError, ImportError): + from ._models import ActiveDeploymentCollection # type: ignore + from ._models import ApiPortalCustomDomainProperties # type: ignore + from ._models import ApiPortalCustomDomainResource # type: ignore + from ._models import ApiPortalCustomDomainResourceCollection # type: ignore + from ._models import ApiPortalInstance # type: ignore + from ._models import ApiPortalProperties # type: ignore + from ._models import ApiPortalResource # type: ignore + from ._models import ApiPortalResourceCollection # type: ignore + from ._models import ApiPortalResourceRequests # type: ignore + from ._models import AppResource # type: ignore + from ._models import AppResourceCollection # type: ignore + from ._models import AppResourceProperties # type: ignore + from ._models import ApplicationInsightsAgentVersions # type: ignore + from ._models import AvailableOperations # type: ignore + from ._models import AvailableRuntimeVersions # type: ignore + from ._models import AzureFileVolume # type: ignore + from ._models import BindingResource # type: ignore + from ._models import BindingResourceCollection # type: ignore + from ._models import BindingResourceProperties # type: ignore + from ._models import Build # type: ignore + from ._models import BuildCollection # type: ignore + from ._models import BuildProperties # type: ignore + from ._models import BuildResult # type: ignore + from ._models import BuildResultCollection # type: ignore + from ._models import BuildResultLog # type: ignore + from ._models import BuildResultProperties # type: ignore + from ._models import BuildResultUserSourceInfo # type: ignore + from ._models import BuildService # type: ignore + from ._models import BuildServiceAgentPoolProperties # type: ignore + from ._models import BuildServiceAgentPoolResource # type: ignore + from ._models import BuildServiceAgentPoolResourceCollection # type: ignore + from ._models import BuildServiceAgentPoolSizeProperties # type: ignore + from ._models import BuildServiceCollection # type: ignore + from ._models import BuildServiceProperties # type: ignore + from ._models import BuildServicePropertiesResourceRequests # type: ignore + from ._models import BuildStageProperties # type: ignore + from ._models import BuilderProperties # type: ignore + from ._models import BuilderResource # type: ignore + from ._models import BuilderResourceCollection # type: ignore + from ._models import BuildpackBindingLaunchProperties # type: ignore + from ._models import BuildpackBindingProperties # type: ignore + from ._models import BuildpackBindingResource # type: ignore + from ._models import BuildpackBindingResourceCollection # type: ignore + from ._models import BuildpackProperties # type: ignore + from ._models import BuildpacksGroupProperties # type: ignore + from ._models import CertificateProperties # type: ignore + from ._models import CertificateResource # type: ignore + from ._models import CertificateResourceCollection # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import ClusterResourceProperties # type: ignore + from ._models import ConfigServerGitProperty # type: ignore + from ._models import ConfigServerProperties # type: ignore + from ._models import ConfigServerResource # type: ignore + from ._models import ConfigServerSettings # type: ignore + from ._models import ConfigServerSettingsErrorRecord # type: ignore + from ._models import ConfigServerSettingsValidateResult # type: ignore + from ._models import ConfigurationServiceGitProperty # type: ignore + from ._models import ConfigurationServiceGitPropertyValidateResult # type: ignore + from ._models import ConfigurationServiceGitRepository # type: ignore + from ._models import ConfigurationServiceInstance # type: ignore + from ._models import ConfigurationServiceProperties # type: ignore + from ._models import ConfigurationServiceResource # type: ignore + from ._models import ConfigurationServiceResourceCollection # type: ignore + from ._models import ConfigurationServiceResourceRequests # type: ignore + from ._models import ConfigurationServiceSettings # type: ignore + from ._models import ConfigurationServiceSettingsValidateResult # type: ignore + from ._models import ContainerProbeSettings # type: ignore + from ._models import ContentCertificateProperties # type: ignore + from ._models import CustomContainer # type: ignore + from ._models import CustomContainerUserSourceInfo # type: ignore + from ._models import CustomDomainProperties # type: ignore + from ._models import CustomDomainResource # type: ignore + from ._models import CustomDomainResourceCollection # type: ignore + from ._models import CustomDomainValidatePayload # type: ignore + from ._models import CustomDomainValidateResult # type: ignore + from ._models import CustomPersistentDiskProperties # type: ignore + from ._models import CustomPersistentDiskResource # type: ignore + from ._models import DeploymentInstance # type: ignore + from ._models import DeploymentResource # type: ignore + from ._models import DeploymentResourceCollection # type: ignore + from ._models import DeploymentResourceProperties # type: ignore + from ._models import DeploymentSettings # type: ignore + from ._models import DiagnosticParameters # type: ignore + from ._models import Error # type: ignore + from ._models import GatewayApiMetadataProperties # type: ignore + from ._models import GatewayApiRoute # type: ignore + from ._models import GatewayCorsProperties # type: ignore + from ._models import GatewayCustomDomainProperties # type: ignore + from ._models import GatewayCustomDomainResource # type: ignore + from ._models import GatewayCustomDomainResourceCollection # type: ignore + from ._models import GatewayInstance # type: ignore + from ._models import GatewayOperatorProperties # type: ignore + from ._models import GatewayOperatorResourceRequests # type: ignore + from ._models import GatewayProperties # type: ignore + from ._models import GatewayResource # type: ignore + from ._models import GatewayResourceCollection # type: ignore + from ._models import GatewayResourceRequests # type: ignore + from ._models import GatewayRouteConfigProperties # type: ignore + from ._models import GatewayRouteConfigResource # type: ignore + from ._models import GatewayRouteConfigResourceCollection # type: ignore + from ._models import GitPatternRepository # type: ignore + from ._models import ImageRegistryCredential # type: ignore + from ._models import JarUploadedUserSourceInfo # type: ignore + from ._models import KeyVaultCertificateProperties # type: ignore + from ._models import LoadedCertificate # type: ignore + from ._models import LogFileUrlResponse # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import ManagedIdentityProperties # type: ignore + from ._models import MetricDimension # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import MonitoringSettingProperties # type: ignore + from ._models import MonitoringSettingResource # type: ignore + from ._models import NameAvailability # type: ignore + from ._models import NameAvailabilityParameters # type: ignore + from ._models import NetCoreZipUploadedUserSourceInfo # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import NetworkProfileOutboundIPs # type: ignore + from ._models import OperationDetail # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import PersistentDisk # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import RegenerateTestKeyRequestPayload # type: ignore + from ._models import RequiredTraffic # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceRequests # type: ignore + from ._models import ResourceSku # type: ignore + from ._models import ResourceSkuCapabilities # type: ignore + from ._models import ResourceSkuCollection # type: ignore + from ._models import ResourceSkuLocationInfo # type: ignore + from ._models import ResourceSkuRestrictionInfo # type: ignore + from ._models import ResourceSkuRestrictions # type: ignore + from ._models import ResourceSkuZoneDetails # type: ignore + from ._models import ResourceUploadDefinition # type: ignore + from ._models import ServiceRegistryInstance # type: ignore + from ._models import ServiceRegistryProperties # type: ignore + from ._models import ServiceRegistryResource # type: ignore + from ._models import ServiceRegistryResourceCollection # type: ignore + from ._models import ServiceRegistryResourceRequests # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SkuCapacity # type: ignore + from ._models import SourceUploadedUserSourceInfo # type: ignore + from ._models import SsoProperties # type: ignore + from ._models import StackProperties # type: ignore + from ._models import StorageAccount # type: ignore + from ._models import StorageProperties # type: ignore + from ._models import StorageResource # type: ignore + from ._models import StorageResourceCollection # type: ignore + from ._models import SupportedBuildpackResource # type: ignore + from ._models import SupportedBuildpackResourceProperties # type: ignore + from ._models import SupportedBuildpacksCollection # type: ignore + from ._models import SupportedRuntimeVersion # type: ignore + from ._models import SupportedStackResource # type: ignore + from ._models import SupportedStackResourceProperties # type: ignore + from ._models import SupportedStacksCollection # type: ignore + from ._models import SystemData # type: ignore + from ._models import TemporaryDisk # type: ignore + from ._models import TestKeys # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import TriggeredBuildResult # type: ignore + from ._models import UploadedUserSourceInfo # type: ignore + from ._models import UserSourceInfo # type: ignore + from ._models import ValidationMessages # type: ignore from ._app_platform_management_client_enums import ( - ActionType, ApiPortalProvisioningState, AppResourceProvisioningState, BindingType, @@ -200,12 +366,10 @@ ResourceSkuRestrictionsType, ServiceRegistryProvisioningState, SkuScaleType, - StorageType, SupportedRuntimePlatform, SupportedRuntimeValue, TestKeyType, TrafficDirection, - Type, ) __all__ = [ @@ -375,7 +539,6 @@ 'UploadedUserSourceInfo', 'UserSourceInfo', 'ValidationMessages', - 'ActionType', 'ApiPortalProvisioningState', 'AppResourceProvisioningState', 'BindingType', @@ -400,10 +563,8 @@ 'ResourceSkuRestrictionsType', 'ServiceRegistryProvisioningState', 'SkuScaleType', - 'StorageType', 'SupportedRuntimePlatform', 'SupportedRuntimeValue', 'TestKeyType', 'TrafficDirection', - 'Type', ] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py index b10f39b3966..6e80cf01dcd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_app_platform_management_client_enums.py @@ -6,18 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) - INTERNAL = "Internal" -class ApiPortalProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ApiPortalProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the API portal. """ @@ -27,7 +36,7 @@ class ApiPortalProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, En FAILED = "Failed" DELETING = "Deleting" -class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AppResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the App """ @@ -37,7 +46,7 @@ class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, UPDATING = "Updating" DELETING = "Deleting" -class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BindingType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Buildpack Binding Type """ @@ -48,7 +57,7 @@ class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NEW_RELIC = "NewRelic" ELASTIC_APM = "ElasticAPM" -class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BuilderProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Builder provision status. """ @@ -58,7 +67,7 @@ class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum FAILED = "Failed" DELETING = "Deleting" -class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BuildpackBindingProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Buildpack Binding. """ @@ -68,7 +77,7 @@ class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, FAILED = "Failed" DELETING = "Deleting" -class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BuildProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the KPack build result """ @@ -78,7 +87,7 @@ class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) FAILED = "Failed" DELETING = "Deleting" -class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BuildResultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the KPack build result """ @@ -88,7 +97,7 @@ class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, FAILED = "Failed" DELETING = "Deleting" -class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class BuildServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the KPack build result """ @@ -98,7 +107,7 @@ class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, FAILED = "Failed" DELETING = "Deleting" -class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfigServerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the config server. """ @@ -108,7 +117,7 @@ class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" UPDATING = "Updating" -class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ConfigurationServiceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Application Configuration Service. """ @@ -118,7 +127,7 @@ class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMe FAILED = "Failed" DELETING = "Deleting" -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -127,7 +136,7 @@ class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Deployment """ @@ -136,14 +145,14 @@ class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta SUCCEEDED = "Succeeded" FAILED = "Failed" -class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeploymentResourceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Status of the Deployment """ STOPPED = "Stopped" RUNNING = "Running" -class GatewayProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class GatewayProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Spring Cloud Gateway. """ @@ -153,7 +162,7 @@ class GatewayProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum FAILED = "Failed" DELETING = "Deleting" -class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KPackBuildStageProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of this build stage resource. """ @@ -162,7 +171,7 @@ class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, s SUCCEEDED = "Succeeded" FAILED = "Failed" -class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -171,7 +180,7 @@ class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the managed identity """ @@ -180,7 +189,7 @@ class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class MonitoringSettingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Monitoring Setting. """ @@ -189,21 +198,19 @@ class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" UPDATING = "Updating" -class PowerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PowerState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Power state of the Service """ RUNNING = "Running" STOPPED = "Stopped" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the Service """ CREATING = "Creating" UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" DELETING = "Deleting" DELETED = "Deleted" SUCCEEDED = "Succeeded" @@ -212,7 +219,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MOVED = "Moved" MOVE_FAILED = "MoveFailed" -class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsReasonCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription' """ @@ -220,14 +227,14 @@ class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, QUOTA_ID = "QuotaId" NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" -class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ResourceSkuRestrictionsType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets the type of restrictions. Possible values include: 'Location', 'Zone' """ LOCATION = "Location" ZONE = "Zone" -class ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ServiceRegistryProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """State of the Service Registry. """ @@ -237,7 +244,7 @@ class ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, s FAILED = "Failed" DELETING = "Deleting" -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the type of the scale. """ @@ -245,20 +252,14 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the storage. - """ - - STORAGE_ACCOUNT = "StorageAccount" - -class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimePlatform(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ JAVA = "Java" _NET_CORE = ".NET Core" -class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SupportedRuntimeValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The raw value which could be passed to deployment CRUD operations. """ @@ -267,22 +268,16 @@ class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): JAVA17 = "Java_17" NET_CORE31 = "NetCore_31" -class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TestKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Type of the test key """ PRIMARY = "Primary" SECONDARY = "Secondary" -class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class TrafficDirection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The direction of required traffic """ INBOUND = "Inbound" OUTBOUND = "Outbound" - -class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the underlying resource to mount as a persistent disk. - """ - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py index 03e80834738..85476a1acfc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/models/_models_py3.py @@ -17,8 +17,8 @@ class ActiveDeploymentCollection(msrest.serialization.Model): """Object that includes an array of Deployment resource name and set them as active. - :ivar active_deployment_names: Collection of Deployment name. - :vartype active_deployment_names: list[str] + :param active_deployment_names: Collection of Deployment name. + :type active_deployment_names: list[str] """ _attribute_map = { @@ -31,10 +31,6 @@ def __init__( active_deployment_names: Optional[List[str]] = None, **kwargs ): - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ super(ActiveDeploymentCollection, self).__init__(**kwargs) self.active_deployment_names = active_deployment_names @@ -42,8 +38,8 @@ def __init__( class ApiPortalCustomDomainProperties(msrest.serialization.Model): """The properties of custom domain for API portal. - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str + :param thumbprint: The thumbprint of bound certificate. + :type thumbprint: str """ _attribute_map = { @@ -56,10 +52,6 @@ def __init__( thumbprint: Optional[str] = None, **kwargs ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ super(ApiPortalCustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint @@ -97,8 +89,6 @@ def __init__( self, **kwargs ): - """ - """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -139,8 +129,6 @@ def __init__( self, **kwargs ): - """ - """ super(ProxyResource, self).__init__(**kwargs) @@ -157,8 +145,8 @@ class ApiPortalCustomDomainResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: + :param properties: The properties of custom domain for API portal. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainProperties """ @@ -183,11 +171,6 @@ def __init__( properties: Optional["ApiPortalCustomDomainProperties"] = None, **kwargs ): - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainProperties - """ super(ApiPortalCustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -195,12 +178,12 @@ def __init__( class ApiPortalCustomDomainResourceCollection(msrest.serialization.Model): """Object that includes an array of API portal custom domain resources and a possible link for next set. - :ivar value: Collection of API portal custom domain resources. - :vartype value: + :param value: Collection of API portal custom domain resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -215,14 +198,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ApiPortalCustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -253,8 +228,6 @@ def __init__( self, **kwargs ): - """ - """ super(ApiPortalInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -269,18 +242,18 @@ class ApiPortalProperties(msrest.serialization.Model): "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProvisioningState - :ivar public: Indicates whether the API portal exposes endpoint. - :vartype public: bool + :param public: Indicates whether the API portal exposes endpoint. + :type public: bool :ivar url: URL of the API portal, exposed when 'public' is true. :vartype url: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool - :ivar gateway_ids: The array of resource Ids of gateway to integrate with API portal. - :vartype gateway_ids: list[str] - :ivar source_urls: Collection of OpenAPI source URL locations. - :vartype source_urls: list[str] - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :param https_only: Indicate if only https is allowed. + :type https_only: bool + :param gateway_ids: The array of resource Ids of gateway to integrate with API portal. + :type gateway_ids: list[str] + :param source_urls: Collection of OpenAPI source URL locations. + :type source_urls: list[str] + :param sso_properties: Single sign-on related configuration. + :type sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties :ivar resource_requests: The requested resource quantity for required CPU and Memory. :vartype resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceRequests @@ -310,25 +283,13 @@ class ApiPortalProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = False, - https_only: Optional[bool] = False, + public: Optional[bool] = None, + https_only: Optional[bool] = None, gateway_ids: Optional[List[str]] = None, source_urls: Optional[List[str]] = None, sso_properties: Optional["SsoProperties"] = None, **kwargs ): - """ - :keyword public: Indicates whether the API portal exposes endpoint. - :paramtype public: bool - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword gateway_ids: The array of resource Ids of gateway to integrate with API portal. - :paramtype gateway_ids: list[str] - :keyword source_urls: Collection of OpenAPI source URL locations. - :paramtype source_urls: list[str] - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties - """ super(ApiPortalProperties, self).__init__(**kwargs) self.provisioning_state = None self.public = public @@ -354,10 +315,10 @@ class ApiPortalResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :param properties: API portal properties payload. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties + :param sku: Sku of the API portal resource. + :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -383,12 +344,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku - """ super(ApiPortalResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -397,11 +352,11 @@ def __init__( class ApiPortalResourceCollection(msrest.serialization.Model): """Object that includes an array of API portal resources and a possible link for next set. - :ivar value: Collection of API portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of API portal resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -416,13 +371,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ApiPortalResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -453,8 +401,6 @@ def __init__( self, **kwargs ): - """ - """ super(ApiPortalResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -481,8 +427,6 @@ def __init__( self, **kwargs ): - """ - """ super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) self.java = None @@ -500,12 +444,12 @@ class AppResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityProperties - :ivar location: The GEO location of the application, always the same with its parent resource. - :vartype location: str + :param properties: Properties of the App resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProperties + :param identity: The Managed Identity type of the app resource. + :type identity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityProperties + :param location: The GEO location of the application, always the same with its parent resource. + :type location: str """ _validation = { @@ -533,16 +477,6 @@ def __init__( location: Optional[str] = None, **kwargs ): - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ super(AppResource, self).__init__(**kwargs) self.properties = properties self.identity = identity @@ -552,11 +486,11 @@ def __init__( class AppResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of App resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of App resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -571,13 +505,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AppResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -588,31 +515,31 @@ class AppResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar public: Indicates whether the App exposes public endpoint. - :vartype public: bool + :param public: Indicates whether the App exposes public endpoint. + :type public: bool :ivar url: URL of the App. :vartype url: str - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, dict[str, any]] + :param addon_configs: Collection of addons. + :type addon_configs: dict[str, dict[str, any]] :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", "Failed", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceProvisioningState - :ivar fqdn: Fully qualified dns Name. - :vartype fqdn: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool - :ivar temporary_disk: Temporary disk settings. - :vartype temporary_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: + :param fqdn: Fully qualified dns Name. + :type fqdn: str + :param https_only: Indicate if only https is allowed. + :type https_only: bool + :param temporary_disk: Temporary disk settings. + :type temporary_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TemporaryDisk + :param persistent_disk: Persistent disk settings. + :type persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk + :param custom_persistent_disks: List of custom persistent disks. + :type custom_persistent_disks: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskResource] - :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :vartype enable_end_to_end_tls: bool - :ivar loaded_certificates: Collection of loaded certificates. - :vartype loaded_certificates: + :param enable_end_to_end_tls: Indicate if end to end TLS is enabled. + :type enable_end_to_end_tls: bool + :param loaded_certificates: Collection of loaded certificates. + :type loaded_certificates: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LoadedCertificate] """ @@ -649,28 +576,6 @@ def __init__( loaded_certificates: Optional[List["LoadedCertificate"]] = None, **kwargs ): - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, dict[str, any]] - :keyword fqdn: Fully qualified dns Name. - :paramtype fqdn: str - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword temporary_disk: Temporary disk settings. - :paramtype temporary_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_01_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskResource] - :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :paramtype enable_end_to_end_tls: bool - :keyword loaded_certificates: Collection of loaded certificates. - :paramtype loaded_certificates: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LoadedCertificate] - """ super(AppResourceProperties, self).__init__(**kwargs) self.public = public self.url = None @@ -688,11 +593,11 @@ def __init__( class AvailableOperations(msrest.serialization.Model): """Available operations of the service. - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of available operation details. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -707,13 +612,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDetail] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(AvailableOperations, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -741,8 +639,6 @@ def __init__( self, **kwargs ): - """ - """ super(AvailableRuntimeVersions, self).__init__(**kwargs) self.value = None @@ -755,15 +651,15 @@ class CustomPersistentDiskProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.Type - :ivar mount_path: Required. The mount path of the persistent disk. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] + :param type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :type type: str + :param mount_path: Required. The mount path of the persistent disk. + :type mount_path: str + :param read_only: Indicates whether the persistent disk is a readOnly one. + :type read_only: bool + :param mount_options: These are the mount options for a persistent disk. + :type mount_options: list[str] """ _validation = { @@ -790,14 +686,6 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): - """ - :keyword mount_path: Required. The mount path of the persistent disk. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ super(CustomPersistentDiskProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.mount_path = mount_path @@ -810,17 +698,17 @@ class AzureFileVolume(CustomPersistentDiskProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.Type - :ivar mount_path: Required. The mount path of the persistent disk. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: Required. The share name of the Azure File share. - :vartype share_name: str + :param type: Required. The type of the underlying resource to mount as a persistent + disk.Constant filled by server. + :type type: str + :param mount_path: Required. The mount path of the persistent disk. + :type mount_path: str + :param read_only: Indicates whether the persistent disk is a readOnly one. + :type read_only: bool + :param mount_options: These are the mount options for a persistent disk. + :type mount_options: list[str] + :param share_name: Required. The share name of the Azure File share. + :type share_name: str """ _validation = { @@ -846,16 +734,6 @@ def __init__( mount_options: Optional[List[str]] = None, **kwargs ): - """ - :keyword mount_path: Required. The mount path of the persistent disk. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: Required. The share name of the Azure File share. - :paramtype share_name: str - """ super(AzureFileVolume, self).__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) self.type = 'AzureFileVolume' # type: str self.share_name = share_name @@ -874,9 +752,8 @@ class BindingResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties + :param properties: Properties of the Binding resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties """ _validation = { @@ -900,11 +777,6 @@ def __init__( properties: Optional["BindingResourceProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceProperties - """ super(BindingResource, self).__init__(**kwargs) self.properties = properties @@ -912,11 +784,11 @@ def __init__( class BindingResourceCollection(msrest.serialization.Model): """Object that includes an array of Binding resources and a possible link for next set. - :ivar value: Collection of Binding resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Binding resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -931,13 +803,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -952,12 +817,12 @@ class BindingResourceProperties(msrest.serialization.Model): :vartype resource_name: str :ivar resource_type: The standard Azure resource type of the bound resource. :vartype resource_type: str - :ivar resource_id: The Azure resource id of the bound resource. - :vartype resource_id: str - :ivar key: The key of the bound resource. - :vartype key: str - :ivar binding_parameters: Binding parameters of the Binding resource. - :vartype binding_parameters: dict[str, any] + :param resource_id: The Azure resource id of the bound resource. + :type resource_id: str + :param key: The key of the bound resource. + :type key: str + :param binding_parameters: Binding parameters of the Binding resource. + :type binding_parameters: dict[str, any] :ivar generated_properties: The generated Spring Boot property file for this binding. The secret will be deducted. :vartype generated_properties: str @@ -994,14 +859,6 @@ def __init__( binding_parameters: Optional[Dict[str, Any]] = None, **kwargs ): - """ - :keyword resource_id: The Azure resource id of the bound resource. - :paramtype resource_id: str - :keyword key: The key of the bound resource. - :paramtype key: str - :keyword binding_parameters: Binding parameters of the Binding resource. - :paramtype binding_parameters: dict[str, any] - """ super(BindingResourceProperties, self).__init__(**kwargs) self.resource_name = None self.resource_type = None @@ -1026,8 +883,8 @@ class Build(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties + :param properties: Properties of the build resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties """ _validation = { @@ -1051,10 +908,6 @@ def __init__( properties: Optional["BuildProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProperties - """ super(Build, self).__init__(**kwargs) self.properties = properties @@ -1062,11 +915,11 @@ def __init__( class BuildCollection(msrest.serialization.Model): """Object that includes an array of Build resources and a possible link for next set. - :ivar value: Collection of Build resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Build resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1081,13 +934,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.Build] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BuildCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1102,10 +948,10 @@ class BuilderProperties(msrest.serialization.Model): "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: + :param stack: Builder cluster stack property. + :type stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties + :param buildpack_groups: Builder buildpack groups. + :type buildpack_groups: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpacksGroupProperties] """ @@ -1126,13 +972,6 @@ def __init__( buildpack_groups: Optional[List["BuildpacksGroupProperties"]] = None, **kwargs ): - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpacksGroupProperties] - """ super(BuilderProperties, self).__init__(**kwargs) self.provisioning_state = None self.stack = stack @@ -1152,8 +991,8 @@ class BuilderResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties + :param properties: Property of the Builder resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties """ _validation = { @@ -1177,10 +1016,6 @@ def __init__( properties: Optional["BuilderProperties"] = None, **kwargs ): - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderProperties - """ super(BuilderResource, self).__init__(**kwargs) self.properties = properties @@ -1188,11 +1023,11 @@ def __init__( class BuilderResourceCollection(msrest.serialization.Model): """Object that includes an array of Builder resources and a possible link for next set. - :ivar value: Collection of Builder resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Builder resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1207,13 +1042,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BuilderResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1222,10 +1050,10 @@ def __init__( class BuildpackBindingLaunchProperties(msrest.serialization.Model): """Buildpack Binding Launch Properties. - :ivar properties: Non-sensitive properties for launchProperties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for launchProperties. - :vartype secrets: dict[str, str] + :param properties: Non-sensitive properties for launchProperties. + :type properties: dict[str, str] + :param secrets: Sensitive properties for launchProperties. + :type secrets: dict[str, str] """ _attribute_map = { @@ -1240,12 +1068,6 @@ def __init__( secrets: Optional[Dict[str, str]] = None, **kwargs ): - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ super(BuildpackBindingLaunchProperties, self).__init__(**kwargs) self.properties = properties self.secrets = secrets @@ -1256,15 +1078,15 @@ class BuildpackBindingProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", + :param binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType + :type binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType :ivar provisioning_state: State of the Buildpack Binding. Possible values include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: + :param launch_properties: The object describes the buildpack binding launch properties. + :type launch_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingLaunchProperties """ @@ -1285,14 +1107,6 @@ def __init__( launch_properties: Optional["BuildpackBindingLaunchProperties"] = None, **kwargs ): - """ - :keyword binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingLaunchProperties - """ super(BuildpackBindingProperties, self).__init__(**kwargs) self.binding_type = binding_type self.provisioning_state = None @@ -1312,9 +1126,8 @@ class BuildpackBindingResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties + :param properties: Properties of a buildpack binding. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties """ _validation = { @@ -1338,11 +1151,6 @@ def __init__( properties: Optional["BuildpackBindingProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingProperties - """ super(BuildpackBindingResource, self).__init__(**kwargs) self.properties = properties @@ -1350,12 +1158,11 @@ def __init__( class BuildpackBindingResourceCollection(msrest.serialization.Model): """Object that includes an array of BuildpackBinding resources and a possible link for next set. - :ivar value: Collection of BuildpackBinding resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of BuildpackBinding resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1370,14 +1177,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BuildpackBindingResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1386,8 +1185,8 @@ def __init__( class BuildpackProperties(msrest.serialization.Model): """Buildpack properties payload. - :ivar id: Id of the buildpack. - :vartype id: str + :param id: Id of the buildpack. + :type id: str """ _attribute_map = { @@ -1400,10 +1199,6 @@ def __init__( id: Optional[str] = None, **kwargs ): - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ super(BuildpackProperties, self).__init__(**kwargs) self.id = id @@ -1411,11 +1206,10 @@ def __init__( class BuildpacksGroupProperties(msrest.serialization.Model): """Buildpack group properties of the Builder. - :ivar name: Buildpack group name. - :vartype name: str - :ivar buildpacks: Buildpacks in the buildpack group. - :vartype buildpacks: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] + :param name: Buildpack group name. + :type name: str + :param buildpacks: Buildpacks in the buildpack group. + :type buildpacks: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] """ _attribute_map = { @@ -1430,13 +1224,6 @@ def __init__( buildpacks: Optional[List["BuildpackProperties"]] = None, **kwargs ): - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackProperties] - """ super(BuildpacksGroupProperties, self).__init__(**kwargs) self.name = name self.buildpacks = buildpacks @@ -1447,18 +1234,18 @@ class BuildProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar relative_path: The relative path of source code. - :vartype relative_path: str - :ivar builder: The resource id of builder to build the source code. - :vartype builder: str - :ivar agent_pool: The resource id of agent pool. - :vartype agent_pool: str + :param relative_path: The relative path of source code. + :type relative_path: str + :param builder: The resource id of builder to build the source code. + :type builder: str + :param agent_pool: The resource id of agent pool. + :type agent_pool: str :ivar provisioning_state: Provisioning state of the KPack build result. Possible values include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] + :param env: The environment variables for this build. + :type env: dict[str, str] :ivar triggered_build_result: The build result triggered by this build. :vartype triggered_build_result: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TriggeredBuildResult @@ -1487,16 +1274,6 @@ def __init__( env: Optional[Dict[str, str]] = None, **kwargs ): - """ - :keyword relative_path: The relative path of source code. - :paramtype relative_path: str - :keyword builder: The resource id of builder to build the source code. - :paramtype builder: str - :keyword agent_pool: The resource id of agent pool. - :paramtype agent_pool: str - :keyword env: The environment variables for this build. - :paramtype env: dict[str, str] - """ super(BuildProperties, self).__init__(**kwargs) self.relative_path = relative_path self.builder = builder @@ -1519,8 +1296,8 @@ class BuildResult(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties + :param properties: Properties of the build result resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties """ _validation = { @@ -1544,10 +1321,6 @@ def __init__( properties: Optional["BuildResultProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProperties - """ super(BuildResult, self).__init__(**kwargs) self.properties = properties @@ -1555,11 +1328,11 @@ def __init__( class BuildResultCollection(msrest.serialization.Model): """Object that includes an array of Build result resources and a possible link for next set. - :ivar value: Collection of Build result resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Build result resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1574,13 +1347,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResult] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BuildResultCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1589,8 +1355,8 @@ def __init__( class BuildResultLog(msrest.serialization.Model): """Build result log resource properties payload. - :ivar blob_url: The public download URL of this build result log. - :vartype blob_url: str + :param blob_url: The public download URL of this build result log. + :type blob_url: str """ _attribute_map = { @@ -1603,10 +1369,6 @@ def __init__( blob_url: Optional[str] = None, **kwargs ): - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ super(BuildResultLog, self).__init__(**kwargs) self.blob_url = blob_url @@ -1616,14 +1378,14 @@ class BuildResultProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The name of this build result. - :vartype name: str + :param name: The name of this build result. + :type name: str :ivar provisioning_state: Provisioning state of the KPack build result. Possible values include: "Queuing", "Building", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultProvisioningState - :ivar build_pod_name: The build pod name which can be used to get the build log streaming. - :vartype build_pod_name: str + :param build_pod_name: The build pod name which can be used to get the build log streaming. + :type build_pod_name: str :ivar build_stages: All of the build stage (init-container and container) resources in build pod. :vartype build_stages: @@ -1649,12 +1411,6 @@ def __init__( build_pod_name: Optional[str] = None, **kwargs ): - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ super(BuildResultProperties, self).__init__(**kwargs) self.name = name self.provisioning_state = None @@ -1670,10 +1426,10 @@ class UserSourceInfo(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str + :param type: Required. Type of the source uploaded.Constant filled by server. + :type type: str + :param version: Version of the source. + :type version: str """ _validation = { @@ -1695,10 +1451,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword version: Version of the source. - :paramtype version: str - """ super(UserSourceInfo, self).__init__(**kwargs) self.type = None # type: Optional[str] self.version = version @@ -1709,13 +1461,13 @@ class BuildResultUserSourceInfo(UserSourceInfo): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring + :param type: Required. Type of the source uploaded.Constant filled by server. + :type type: str + :param version: Version of the source. + :type version: str + :param build_result_id: Resource id of an existing succeeded build result under the same Spring instance. - :vartype build_result_id: str + :type build_result_id: str """ _validation = { @@ -1735,13 +1487,6 @@ def __init__( build_result_id: Optional[str] = None, **kwargs ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword build_result_id: Resource id of an existing succeeded build result under the same - Spring instance. - :paramtype build_result_id: str - """ super(BuildResultUserSourceInfo, self).__init__(version=version, **kwargs) self.type = 'BuildResult' # type: str self.build_result_id = build_result_id @@ -1760,8 +1505,8 @@ class BuildService(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties + :param properties: Properties of the build resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties """ _validation = { @@ -1785,11 +1530,6 @@ def __init__( properties: Optional["BuildServiceProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProperties - """ super(BuildService, self).__init__(**kwargs) self.properties = properties @@ -1801,8 +1541,8 @@ class BuildServiceAgentPoolProperties(msrest.serialization.Model): :ivar provisioning_state: Provisioning state of the build service agent pool. :vartype provisioning_state: str - :ivar pool_size: build service agent pool size properties. - :vartype pool_size: + :param pool_size: build service agent pool size properties. + :type pool_size: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties """ @@ -1821,11 +1561,6 @@ def __init__( pool_size: Optional["BuildServiceAgentPoolSizeProperties"] = None, **kwargs ): - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties - """ super(BuildServiceAgentPoolProperties, self).__init__(**kwargs) self.provisioning_state = None self.pool_size = pool_size @@ -1844,8 +1579,8 @@ class BuildServiceAgentPoolResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: + :param properties: build service agent pool properties. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolProperties """ @@ -1870,11 +1605,6 @@ def __init__( properties: Optional["BuildServiceAgentPoolProperties"] = None, **kwargs ): - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolProperties - """ super(BuildServiceAgentPoolResource, self).__init__(**kwargs) self.properties = properties @@ -1882,12 +1612,12 @@ def __init__( class BuildServiceAgentPoolResourceCollection(msrest.serialization.Model): """Object that includes an array of build service agent pool resources and a possible link for next set. - :ivar value: Collection of build service agent pool resource. - :vartype value: + :param value: Collection of build service agent pool resource. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1902,14 +1632,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BuildServiceAgentPoolResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1920,8 +1642,8 @@ class BuildServiceAgentPoolSizeProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The name of build service agent pool size. - :vartype name: str + :param name: The name of build service agent pool size. + :type name: str :ivar cpu: The cpu property of build service agent pool size. :vartype cpu: str :ivar memory: The memory property of build service agent pool size. @@ -1945,10 +1667,6 @@ def __init__( name: Optional[str] = None, **kwargs ): - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ super(BuildServiceAgentPoolSizeProperties, self).__init__(**kwargs) self.name = name self.cpu = None @@ -1958,11 +1676,11 @@ def __init__( class BuildServiceCollection(msrest.serialization.Model): """Object that includes an array of Build service resources and a possible link for next set. - :ivar value: Collection of Build service resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Build service resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -1977,13 +1695,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildService] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(BuildServiceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1994,14 +1705,14 @@ class BuildServiceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar k_pack_version: The installed KPack version in this build service. - :vartype k_pack_version: str + :param k_pack_version: The installed KPack version in this build service. + :type k_pack_version: str :ivar provisioning_state: Provisioning state of the KPack build result. Possible values include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: + :param resource_requests: The runtime resource configuration of this build service. + :type resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServicePropertiesResourceRequests """ @@ -2022,13 +1733,6 @@ def __init__( resource_requests: Optional["BuildServicePropertiesResourceRequests"] = None, **kwargs ): - """ - :keyword k_pack_version: The installed KPack version in this build service. - :paramtype k_pack_version: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServicePropertiesResourceRequests - """ super(BuildServiceProperties, self).__init__(**kwargs) self.k_pack_version = k_pack_version self.provisioning_state = None @@ -2060,8 +1764,6 @@ def __init__( self, **kwargs ): - """ - """ super(BuildServicePropertiesResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -2094,8 +1796,6 @@ def __init__( self, **kwargs ): - """ - """ super(BuildStageProperties, self).__init__(**kwargs) self.name = None self.status = None @@ -2111,8 +1811,8 @@ class CertificateProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str + :param type: Required. The type of the certificate source.Constant filled by server. + :type type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -2159,8 +1859,6 @@ def __init__( self, **kwargs ): - """ - """ super(CertificateProperties, self).__init__(**kwargs) self.type = None # type: Optional[str] self.thumbprint = None @@ -2185,8 +1883,8 @@ class CertificateResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties + :param properties: Properties of the certificate resource payload. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties """ _validation = { @@ -2210,10 +1908,6 @@ def __init__( properties: Optional["CertificateProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateProperties - """ super(CertificateResource, self).__init__(**kwargs) self.properties = properties @@ -2221,10 +1915,10 @@ def __init__( class CertificateResourceCollection(msrest.serialization.Model): """Collection compose of certificate resources list and a possible link for next page. - :ivar value: The certificate resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :ivar next_link: The link to next page of certificate list. - :vartype next_link: str + :param value: The certificate resources list. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] + :param next_link: The link to next page of certificate list. + :type next_link: str """ _attribute_map = { @@ -2239,12 +1933,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ super(CertificateResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2253,17 +1941,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed + :param code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user + :type code: str + :param message: A message describing the error, intended to be suitable for display in a user interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in + :type message: str + :param target: The target of the particular error. For example, the name of the property in error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CloudErrorBody] + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CloudErrorBody] """ _attribute_map = { @@ -2282,19 +1970,6 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CloudErrorBody] - """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -2308,20 +1983,20 @@ class ClusterResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Provisioning state of the Service. Possible values include: - "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", - "Moving", "Moved", "MoveFailed". + "Creating", "Updating", "Deleting", "Deleted", "Succeeded", "Failed", "Moving", "Moved", + "MoveFailed". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfile + :param network_profile: Network profile of the Service. + :type network_profile: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfile :ivar version: Version of the Service. :vartype version: int :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. :vartype service_id: str :ivar power_state: Power state of the Service. Possible values include: "Running", "Stopped". :vartype power_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool + :param zone_redundant: + :type zone_redundant: bool :ivar fqdn: Fully qualified dns name of the service instance. :vartype fqdn: str """ @@ -2351,12 +2026,6 @@ def __init__( zone_redundant: Optional[bool] = False, **kwargs ): - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfile - :keyword zone_redundant: - :paramtype zone_redundant: bool - """ super(ClusterResourceProperties, self).__init__(**kwargs) self.provisioning_state = None self.network_profile = network_profile @@ -2372,27 +2041,27 @@ class ConfigServerGitProperty(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar repositories: Repositories of git. - :vartype repositories: + :param repositories: Repositories of git. + :type repositories: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GitPatternRepository] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -2427,29 +2096,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GitPatternRepository] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(ConfigServerGitProperty, self).__init__(**kwargs) self.repositories = repositories self.uri = uri @@ -2472,10 +2118,10 @@ class ConfigServerProperties(msrest.serialization.Model): "Deleted", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings + :param error: Error when apply config server settings. + :type error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error + :param config_server: Settings of config server. + :type config_server: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings """ _validation = { @@ -2495,13 +2141,6 @@ def __init__( config_server: Optional["ConfigServerSettings"] = None, **kwargs ): - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings - """ super(ConfigServerProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -2521,8 +2160,8 @@ class ConfigServerResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties + :param properties: Properties of the Config Server resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties """ _validation = { @@ -2546,11 +2185,6 @@ def __init__( properties: Optional["ConfigServerProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerProperties - """ super(ConfigServerResource, self).__init__(**kwargs) self.properties = properties @@ -2558,9 +2192,8 @@ def __init__( class ConfigServerSettings(msrest.serialization.Model): """The settings of config server. - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerGitProperty + :param git_property: Property of git environment. + :type git_property: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerGitProperty """ _attribute_map = { @@ -2573,11 +2206,6 @@ def __init__( git_property: Optional["ConfigServerGitProperty"] = None, **kwargs ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerGitProperty - """ super(ConfigServerSettings, self).__init__(**kwargs) self.git_property = git_property @@ -2585,12 +2213,12 @@ def __init__( class ConfigServerSettingsErrorRecord(msrest.serialization.Model): """Error record of the config server settings. - :ivar name: The name of the config server settings error record. - :vartype name: str - :ivar uri: The uri of the config server settings error record. - :vartype uri: str - :ivar messages: The detail error messages of the record. - :vartype messages: list[str] + :param name: The name of the config server settings error record. + :type name: str + :param uri: The uri of the config server settings error record. + :type uri: str + :param messages: The detail error messages of the record. + :type messages: list[str] """ _attribute_map = { @@ -2607,14 +2235,6 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): - """ - :keyword name: The name of the config server settings error record. - :paramtype name: str - :keyword uri: The uri of the config server settings error record. - :paramtype uri: str - :keyword messages: The detail error messages of the record. - :paramtype messages: list[str] - """ super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) self.name = name self.uri = uri @@ -2624,10 +2244,10 @@ def __init__( class ConfigServerSettingsValidateResult(msrest.serialization.Model): """Validation result for config server settings. - :ivar is_valid: Indicate if the config server settings are valid. - :vartype is_valid: bool - :ivar details: The detail validation results. - :vartype details: + :param is_valid: Indicate if the config server settings are valid. + :type is_valid: bool + :param details: The detail validation results. + :type details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsErrorRecord] """ @@ -2643,13 +2263,6 @@ def __init__( details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, **kwargs ): - """ - :keyword is_valid: Indicate if the config server settings are valid. - :paramtype is_valid: bool - :keyword details: The detail validation results. - :paramtype details: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsErrorRecord] - """ super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.details = details @@ -2658,8 +2271,8 @@ def __init__( class ConfigurationServiceGitProperty(msrest.serialization.Model): """Property of git environment. - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: + :param repositories: Repositories of Application Configuration Service git property. + :type repositories: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitRepository] """ @@ -2673,11 +2286,6 @@ def __init__( repositories: Optional[List["ConfigurationServiceGitRepository"]] = None, **kwargs ): - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitRepository] - """ super(ConfigurationServiceGitProperty, self).__init__(**kwargs) self.repositories = repositories @@ -2685,10 +2293,10 @@ def __init__( class ConfigurationServiceGitPropertyValidateResult(msrest.serialization.Model): """Validation result for configuration service settings. - :ivar is_valid: Indicate if the configuration service settings are valid. - :vartype is_valid: bool - :ivar git_repos_validation_result: The detail validation results. - :vartype git_repos_validation_result: + :param is_valid: Indicate if the configuration service settings are valid. + :type is_valid: bool + :param git_repos_validation_result: The detail validation results. + :type git_repos_validation_result: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ValidationMessages] """ @@ -2704,13 +2312,6 @@ def __init__( git_repos_validation_result: Optional[List["ValidationMessages"]] = None, **kwargs ): - """ - :keyword is_valid: Indicate if the configuration service settings are valid. - :paramtype is_valid: bool - :keyword git_repos_validation_result: The detail validation results. - :paramtype git_repos_validation_result: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ValidationMessages] - """ super(ConfigurationServiceGitPropertyValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.git_repos_validation_result = git_repos_validation_result @@ -2721,28 +2322,28 @@ class ConfigurationServiceGitRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar patterns: Required. Collection of patterns of the repository. - :vartype patterns: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Required. Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param name: Required. Name of the repository. + :type name: str + :param patterns: Required. Collection of patterns of the repository. + :type patterns: list[str] + :param uri: Required. URI of the repository. + :type uri: str + :param label: Required. Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -2782,30 +2383,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword patterns: Required. Collection of patterns of the repository. - :paramtype patterns: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Required. Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(ConfigurationServiceGitRepository, self).__init__(**kwargs) self.name = name self.patterns = patterns @@ -2845,8 +2422,6 @@ def __init__( self, **kwargs ): - """ - """ super(ConfigurationServiceInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -2867,9 +2442,8 @@ class ConfigurationServiceProperties(msrest.serialization.Model): :ivar instances: Collection of instances belong to Application Configuration Service. :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings + :param settings: The settings of Application Configuration Service. + :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings """ _validation = { @@ -2891,11 +2465,6 @@ def __init__( settings: Optional["ConfigurationServiceSettings"] = None, **kwargs ): - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings - """ super(ConfigurationServiceProperties, self).__init__(**kwargs) self.provisioning_state = None self.resource_requests = None @@ -2916,8 +2485,8 @@ class ConfigurationServiceResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: + :param properties: Application Configuration Service properties payload. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProperties """ @@ -2942,11 +2511,6 @@ def __init__( properties: Optional["ConfigurationServiceProperties"] = None, **kwargs ): - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceProperties - """ super(ConfigurationServiceResource, self).__init__(**kwargs) self.properties = properties @@ -2954,12 +2518,12 @@ def __init__( class ConfigurationServiceResourceCollection(msrest.serialization.Model): """Object that includes an array of configuration service resources and a possible link for next set. - :ivar value: Collection of configuration service resources. - :vartype value: + :param value: Collection of configuration service resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -2974,14 +2538,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ConfigurationServiceResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3016,8 +2572,6 @@ def __init__( self, **kwargs ): - """ - """ super(ConfigurationServiceResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -3027,8 +2581,8 @@ def __init__( class ConfigurationServiceSettings(msrest.serialization.Model): """The settings of Application Configuration Service. - :ivar git_property: Property of git environment. - :vartype git_property: + :param git_property: Property of git environment. + :type git_property: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitProperty """ @@ -3042,11 +2596,6 @@ def __init__( git_property: Optional["ConfigurationServiceGitProperty"] = None, **kwargs ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitProperty - """ super(ConfigurationServiceSettings, self).__init__(**kwargs) self.git_property = git_property @@ -3054,8 +2603,8 @@ def __init__( class ConfigurationServiceSettingsValidateResult(msrest.serialization.Model): """Validation result for configuration service settings. - :ivar git_property_validation_result: Validation result for configuration service settings. - :vartype git_property_validation_result: + :param git_property_validation_result: Validation result for configuration service settings. + :type git_property_validation_result: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult """ @@ -3069,11 +2618,6 @@ def __init__( git_property_validation_result: Optional["ConfigurationServiceGitPropertyValidateResult"] = None, **kwargs ): - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ super(ConfigurationServiceSettingsValidateResult, self).__init__(**kwargs) self.git_property_validation_result = git_property_validation_result @@ -3081,8 +2625,8 @@ def __init__( class ContainerProbeSettings(msrest.serialization.Model): """Container liveness and readiness probe settings. - :ivar disable_probe: Indicates whether disable the liveness and readiness probe. - :vartype disable_probe: bool + :param disable_probe: Indicates whether disable the liveness and readiness probe. + :type disable_probe: bool """ _attribute_map = { @@ -3095,10 +2639,6 @@ def __init__( disable_probe: Optional[bool] = None, **kwargs ): - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ super(ContainerProbeSettings, self).__init__(**kwargs) self.disable_probe = disable_probe @@ -3110,8 +2650,8 @@ class ContentCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str + :param type: Required. The type of the certificate source.Constant filled by server. + :type type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -3126,8 +2666,8 @@ class ContentCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :ivar content: The content of uploaded certificate. - :vartype content: str + :param content: Required. The content of uploaded certificate. + :type content: str """ _validation = { @@ -3139,6 +2679,7 @@ class ContentCertificateProperties(CertificateProperties): 'activate_date': {'readonly': True}, 'subject_name': {'readonly': True}, 'dns_names': {'readonly': True}, + 'content': {'required': True}, } _attribute_map = { @@ -3156,13 +2697,9 @@ class ContentCertificateProperties(CertificateProperties): def __init__( self, *, - content: Optional[str] = None, + content: str, **kwargs ): - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ super(ContentCertificateProperties, self).__init__(**kwargs) self.type = 'ContentCertificate' # type: str self.content = content @@ -3171,19 +2708,19 @@ def __init__( class CustomContainer(msrest.serialization.Model): """Custom container payload. - :ivar server: The name of the registry that contains the container image. - :vartype server: str - :ivar container_image: Container image of the custom container. This should be in the form of + :param server: The name of the registry that contains the container image. + :type server: str + :param container_image: Container image of the custom container. This should be in the form of :code:``::code:`` without the server name of the registry. - :vartype container_image: str - :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is + :type container_image: str + :param command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is used if this is not provided. - :vartype command: list[str] - :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not + :type command: list[str] + :param args: Arguments to the entrypoint. The docker image's CMD is used if this is not provided. - :vartype args: list[str] - :ivar image_registry_credential: Credential of the image registry. - :vartype image_registry_credential: + :type args: list[str] + :param image_registry_credential: Credential of the image registry. + :type image_registry_credential: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ImageRegistryCredential """ @@ -3205,22 +2742,6 @@ def __init__( image_registry_credential: Optional["ImageRegistryCredential"] = None, **kwargs ): - """ - :keyword server: The name of the registry that contains the container image. - :paramtype server: str - :keyword container_image: Container image of the custom container. This should be in the form - of :code:``::code:`` without the server name of the registry. - :paramtype container_image: str - :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT - is used if this is not provided. - :paramtype command: list[str] - :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not - provided. - :paramtype args: list[str] - :keyword image_registry_credential: Credential of the image registry. - :paramtype image_registry_credential: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ImageRegistryCredential - """ super(CustomContainer, self).__init__(**kwargs) self.server = server self.container_image = container_image @@ -3234,12 +2755,12 @@ class CustomContainerUserSourceInfo(UserSourceInfo): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer + :param type: Required. Type of the source uploaded.Constant filled by server. + :type type: str + :param version: Version of the source. + :type version: str + :param custom_container: Custom container payload. + :type custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer """ _validation = { @@ -3259,12 +2780,6 @@ def __init__( custom_container: Optional["CustomContainer"] = None, **kwargs ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomContainer - """ super(CustomContainerUserSourceInfo, self).__init__(version=version, **kwargs) self.type = 'Container' # type: str self.custom_container = custom_container @@ -3275,12 +2790,12 @@ class CustomDomainProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str + :param thumbprint: The thumbprint of bound certificate. + :type thumbprint: str :ivar app_name: The app name of domain. :vartype app_name: str - :ivar cert_name: The bound certificate name of domain. - :vartype cert_name: str + :param cert_name: The bound certificate name of domain. + :type cert_name: str """ _validation = { @@ -3300,12 +2815,6 @@ def __init__( cert_name: Optional[str] = None, **kwargs ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ super(CustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint self.app_name = None @@ -3325,8 +2834,8 @@ class CustomDomainResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties + :param properties: Properties of the custom domain resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties """ _validation = { @@ -3350,11 +2859,6 @@ def __init__( properties: Optional["CustomDomainProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainProperties - """ super(CustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -3362,10 +2866,10 @@ def __init__( class CustomDomainResourceCollection(msrest.serialization.Model): """Collection compose of a custom domain resources list and a possible link for next page. - :ivar value: The custom domain resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :ivar next_link: The link to next page of custom domain list. - :vartype next_link: str + :param value: The custom domain resources list. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :param next_link: The link to next page of custom domain list. + :type next_link: str """ _attribute_map = { @@ -3380,12 +2884,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ super(CustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3396,8 +2894,8 @@ class CustomDomainValidatePayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name to be validated. - :vartype name: str + :param name: Required. Name to be validated. + :type name: str """ _validation = { @@ -3414,10 +2912,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword name: Required. Name to be validated. - :paramtype name: str - """ super(CustomDomainValidatePayload, self).__init__(**kwargs) self.name = name @@ -3425,10 +2919,10 @@ def __init__( class CustomDomainValidateResult(msrest.serialization.Model): """Validation result for custom domain. - :ivar is_valid: Indicates if domain name is valid. - :vartype is_valid: bool - :ivar message: Message of why domain name is invalid. - :vartype message: str + :param is_valid: Indicates if domain name is valid. + :type is_valid: bool + :param message: Message of why domain name is invalid. + :type message: str """ _attribute_map = { @@ -3443,12 +2937,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword is_valid: Indicates if domain name is valid. - :paramtype is_valid: bool - :keyword message: Message of why domain name is invalid. - :paramtype message: str - """ super(CustomDomainValidateResult, self).__init__(**kwargs) self.is_valid = is_valid self.message = message @@ -3459,12 +2947,12 @@ class CustomPersistentDiskResource(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource + :param custom_persistent_disk_properties: Properties of the custom persistent disk resource payload. - :vartype custom_persistent_disk_properties: + :type custom_persistent_disk_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: Required. The resource id of Azure Spring Cloud Storage resource. - :vartype storage_id: str + :param storage_id: Required. The resource id of Azure Spring Cloud Storage resource. + :type storage_id: str """ _validation = { @@ -3483,14 +2971,6 @@ def __init__( custom_persistent_disk_properties: Optional["CustomPersistentDiskProperties"] = None, **kwargs ): - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: Required. The resource id of Azure Spring Cloud Storage resource. - :paramtype storage_id: str - """ super(CustomPersistentDiskResource, self).__init__(**kwargs) self.custom_persistent_disk_properties = custom_persistent_disk_properties self.storage_id = storage_id @@ -3537,8 +3017,6 @@ def __init__( self, **kwargs ): - """ - """ super(DeploymentInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -3561,11 +3039,11 @@ class DeploymentResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: + :param properties: Properties of the Deployment resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :param sku: Sku of the Deployment resource. + :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -3591,13 +3069,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku - """ super(DeploymentResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -3606,11 +3077,11 @@ def __init__( class DeploymentResourceCollection(msrest.serialization.Model): """Object that includes an array of App resources and a possible link for next set. - :ivar value: Collection of Deployment resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Deployment resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -3625,13 +3096,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(DeploymentResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3642,10 +3106,10 @@ class DeploymentResourceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar source: Uploaded source information of the deployment. - :vartype source: ~azure.mgmt.appplatform.v2022_01_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: + :param source: Uploaded source information of the deployment. + :type source: ~azure.mgmt.appplatform.v2022_01_01_preview.models.UserSourceInfo + :param deployment_settings: Deployment settings of the Deployment. + :type deployment_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentSettings :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: "Creating", "Updating", "Succeeded", "Failed". @@ -3654,8 +3118,8 @@ class DeploymentResourceProperties(msrest.serialization.Model): :ivar status: Status of the Deployment. Possible values include: "Stopped", "Running". :vartype status: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active. - :vartype active: bool + :param active: Indicates whether the Deployment is active. + :type active: bool :ivar instances: Collection of instances belong to the Deployment. :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentInstance] """ @@ -3683,15 +3147,6 @@ def __init__( active: Optional[bool] = None, **kwargs ): - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_01_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ super(DeploymentResourceProperties, self).__init__(**kwargs) self.source = source self.deployment_settings = deployment_settings @@ -3704,16 +3159,16 @@ def __init__( class DeploymentSettings(msrest.serialization.Model): """Deployment settings payload. - :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is + :param resource_requests: The requested resource quantity for required CPU and Memory. It is recommended that using this field to represent the required CPU and Memory, the old field cpu and memoryInGB will be deprecated later. - :vartype resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, dict[str, any]] - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: + :type resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceRequests + :param environment_variables: Collection of environment variables. + :type environment_variables: dict[str, str] + :param addon_configs: Collection of addons. + :type addon_configs: dict[str, dict[str, any]] + :param container_probe_settings: Container liveness and readiness probe settings. + :type container_probe_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ContainerProbeSettings """ @@ -3733,20 +3188,6 @@ def __init__( container_probe_settings: Optional["ContainerProbeSettings"] = None, **kwargs ): - """ - :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, dict[str, any]] - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ContainerProbeSettings - """ super(DeploymentSettings, self).__init__(**kwargs) self.resource_requests = resource_requests self.environment_variables = environment_variables @@ -3757,12 +3198,12 @@ def __init__( class DiagnosticParameters(msrest.serialization.Model): """Diagnostic parameters of diagnostic operations. - :ivar app_instance: App instance name. - :vartype app_instance: str - :ivar file_path: Your target file path in your own BYOS. - :vartype file_path: str - :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :vartype duration: str + :param app_instance: App instance name. + :type app_instance: str + :param file_path: Your target file path in your own BYOS. + :type file_path: str + :param duration: Duration of your JFR. 1 min can be represented by 1m or 60s. + :type duration: str """ _attribute_map = { @@ -3779,14 +3220,6 @@ def __init__( duration: Optional[str] = None, **kwargs ): - """ - :keyword app_instance: App instance name. - :paramtype app_instance: str - :keyword file_path: Your target file path in your own BYOS. - :paramtype file_path: str - :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :paramtype duration: str - """ super(DiagnosticParameters, self).__init__(**kwargs) self.app_instance = app_instance self.file_path = file_path @@ -3796,10 +3229,10 @@ def __init__( class Error(msrest.serialization.Model): """The error code compose of code and message. - :ivar code: The code of error. - :vartype code: str - :ivar message: The message of error. - :vartype message: str + :param code: The code of error. + :type code: str + :param message: The message of error. + :type message: str """ _attribute_map = { @@ -3814,12 +3247,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ super(Error, self).__init__(**kwargs) self.code = code self.message = message @@ -3828,19 +3255,20 @@ def __init__( class GatewayApiMetadataProperties(msrest.serialization.Model): """API metadata property for Spring Cloud Gateway. - :ivar title: Title describing the context of the APIs available on the Gateway instance + :param title: Title describing the context of the APIs available on the Gateway instance (default: ``Spring Cloud Gateway for K8S``\ ). - :vartype title: str - :ivar description: Detailed description of the APIs available on the Gateway instance (default: - ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). - :vartype description: str - :ivar documentation: Location of additional documentation for the APIs available on the Gateway - instance. - :vartype documentation: str - :ivar version: Version of APIs available on this Gateway instance (default: ``unspecified``\ ). - :vartype version: str - :ivar server_url: Base URL that API consumers will use to access APIs on the Gateway instance. - :vartype server_url: str + :type title: str + :param description: Detailed description of the APIs available on the Gateway instance + (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). + :type description: str + :param documentation: Location of additional documentation for the APIs available on the + Gateway instance. + :type documentation: str + :param version: Version of APIs available on this Gateway instance (default: ``unspecified``\ + ). + :type version: str + :param server_url: Base URL that API consumers will use to access APIs on the Gateway instance. + :type server_url: str """ _attribute_map = { @@ -3861,23 +3289,6 @@ def __init__( server_url: Optional[str] = None, **kwargs ): - """ - :keyword title: Title describing the context of the APIs available on the Gateway instance - (default: ``Spring Cloud Gateway for K8S``\ ). - :paramtype title: str - :keyword description: Detailed description of the APIs available on the Gateway instance - (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). - :paramtype description: str - :keyword documentation: Location of additional documentation for the APIs available on the - Gateway instance. - :paramtype documentation: str - :keyword version: Version of APIs available on this Gateway instance (default: ``unspecified``\ - ). - :paramtype version: str - :keyword server_url: Base URL that API consumers will use to access APIs on the Gateway - instance. - :paramtype server_url: str - """ super(GatewayApiMetadataProperties, self).__init__(**kwargs) self.title = title self.description = description @@ -3889,30 +3300,30 @@ def __init__( class GatewayApiRoute(msrest.serialization.Model): """API route config of the Spring Cloud Gateway. - :ivar title: A title, will be applied to methods in the generated OpenAPI documentation. - :vartype title: str - :ivar description: A description, will be applied to methods in the generated OpenAPI + :param title: A title, will be applied to methods in the generated OpenAPI documentation. + :type title: str + :param description: A description, will be applied to methods in the generated OpenAPI documentation. - :vartype description: str - :ivar uri: Full uri, will override ``appName``. - :vartype uri: str - :ivar sso_enabled: Enable sso validation. - :vartype sso_enabled: bool - :ivar token_relay: Pass currently-authenticated user's identity token to application service, + :type description: str + :param uri: Full uri, will override ``appName``. + :type uri: str + :param sso_enabled: Enable sso validation. + :type sso_enabled: bool + :param token_relay: Pass currently-authenticated user's identity token to application service, default is 'false'. - :vartype token_relay: bool - :ivar predicates: A number of conditions to evaluate a route for each request. Each predicate + :type token_relay: bool + :param predicates: A number of conditions to evaluate a route for each request. Each predicate may be evaluated against request headers and parameter values. All of the predicates associated with a route must evaluate to true for the route to be matched to the request. - :vartype predicates: list[str] - :ivar filters: To modify the request before sending it to the target endpoint, or the received + :type predicates: list[str] + :param filters: To modify the request before sending it to the target endpoint, or the received response. - :vartype filters: list[str] - :ivar order: Route processing order. - :vartype order: int - :ivar tags: A set of tags. Classification tags, will be applied to methods in the generated + :type filters: list[str] + :param order: Route processing order. + :type order: int + :param tags: A set of tags. Classification tags, will be applied to methods in the generated OpenAPI documentation. - :vartype tags: list[str] + :type tags: list[str] """ _attribute_map = { @@ -3941,32 +3352,6 @@ def __init__( tags: Optional[List[str]] = None, **kwargs ): - """ - :keyword title: A title, will be applied to methods in the generated OpenAPI documentation. - :paramtype title: str - :keyword description: A description, will be applied to methods in the generated OpenAPI - documentation. - :paramtype description: str - :keyword uri: Full uri, will override ``appName``. - :paramtype uri: str - :keyword sso_enabled: Enable sso validation. - :paramtype sso_enabled: bool - :keyword token_relay: Pass currently-authenticated user's identity token to application - service, default is 'false'. - :paramtype token_relay: bool - :keyword predicates: A number of conditions to evaluate a route for each request. Each - predicate may be evaluated against request headers and parameter values. All of the predicates - associated with a route must evaluate to true for the route to be matched to the request. - :paramtype predicates: list[str] - :keyword filters: To modify the request before sending it to the target endpoint, or the - received response. - :paramtype filters: list[str] - :keyword order: Route processing order. - :paramtype order: int - :keyword tags: A set of tags. Classification tags, will be applied to methods in the generated - OpenAPI documentation. - :paramtype tags: list[str] - """ super(GatewayApiRoute, self).__init__(**kwargs) self.title = title self.description = description @@ -3982,23 +3367,23 @@ def __init__( class GatewayCorsProperties(msrest.serialization.Model): """Cross-Origin Resource Sharing property. - :ivar allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` + :param allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` allows all domains. - :vartype allowed_origins: list[str] - :ivar allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` + :type allowed_origins: list[str] + :param allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. - :vartype allowed_methods: list[str] - :ivar allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows + :type allowed_methods: list[str] + :param allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows actual requests to send any header. - :vartype allowed_headers: list[str] - :ivar max_age: How long, in seconds, the response from a pre-flight request can be cached by + :type allowed_headers: list[str] + :param max_age: How long, in seconds, the response from a pre-flight request can be cached by clients. - :vartype max_age: int - :ivar allow_credentials: Whether user credentials are supported on cross-site requests. Valid + :type max_age: int + :param allow_credentials: Whether user credentials are supported on cross-site requests. Valid values: ``true``\ , ``false``. - :vartype allow_credentials: bool - :ivar exposed_headers: HTTP response headers to expose for cross-site requests. - :vartype exposed_headers: list[str] + :type allow_credentials: bool + :param exposed_headers: HTTP response headers to expose for cross-site requests. + :type exposed_headers: list[str] """ _attribute_map = { @@ -4021,25 +3406,6 @@ def __init__( exposed_headers: Optional[List[str]] = None, **kwargs ): - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` - allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. - :paramtype allowed_methods: list[str] - :keyword allowed_headers: Allowed headers in cross-site requests. The special value ``*`` - allows actual requests to send any header. - :paramtype allowed_headers: list[str] - :keyword max_age: How long, in seconds, the response from a pre-flight request can be cached by - clients. - :paramtype max_age: int - :keyword allow_credentials: Whether user credentials are supported on cross-site requests. - Valid values: ``true``\ , ``false``. - :paramtype allow_credentials: bool - :keyword exposed_headers: HTTP response headers to expose for cross-site requests. - :paramtype exposed_headers: list[str] - """ super(GatewayCorsProperties, self).__init__(**kwargs) self.allowed_origins = allowed_origins self.allowed_methods = allowed_methods @@ -4052,8 +3418,8 @@ def __init__( class GatewayCustomDomainProperties(msrest.serialization.Model): """The properties of custom domain for Spring Cloud Gateway. - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str + :param thumbprint: The thumbprint of bound certificate. + :type thumbprint: str """ _attribute_map = { @@ -4066,10 +3432,6 @@ def __init__( thumbprint: Optional[str] = None, **kwargs ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ super(GatewayCustomDomainProperties, self).__init__(**kwargs) self.thumbprint = thumbprint @@ -4087,8 +3449,8 @@ class GatewayCustomDomainResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: + :param properties: The properties of custom domain for Spring Cloud Gateway. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainProperties """ @@ -4113,11 +3475,6 @@ def __init__( properties: Optional["GatewayCustomDomainProperties"] = None, **kwargs ): - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainProperties - """ super(GatewayCustomDomainResource, self).__init__(**kwargs) self.properties = properties @@ -4125,12 +3482,12 @@ def __init__( class GatewayCustomDomainResourceCollection(msrest.serialization.Model): """Object that includes an array of Spring Cloud Gateway custom domain resources and a possible link for next set. - :ivar value: Collection of Spring Cloud Gateway custom domain resources. - :vartype value: + :param value: Collection of Spring Cloud Gateway custom domain resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -4145,14 +3502,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(GatewayCustomDomainResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4183,8 +3532,6 @@ def __init__( self, **kwargs ): - """ - """ super(GatewayInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -4216,8 +3563,6 @@ def __init__( self, **kwargs ): - """ - """ super(GatewayOperatorProperties, self).__init__(**kwargs) self.resource_requests = None self.instances = None @@ -4252,8 +3597,6 @@ def __init__( self, **kwargs ): - """ - """ super(GatewayOperatorResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -4269,22 +3612,21 @@ class GatewayProperties(msrest.serialization.Model): "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProvisioningState - :ivar public: Indicates whether the Spring Cloud Gateway exposes endpoint. - :vartype public: bool + :param public: Indicates whether the Spring Cloud Gateway exposes endpoint. + :type public: bool :ivar url: URL of the Spring Cloud Gateway, exposed when 'public' is true. :vartype url: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: + :param https_only: Indicate if only https is allowed. + :type https_only: bool + :param sso_properties: Single sign-on related configuration. + :type sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties + :param api_metadata_properties: API metadata property for Spring Cloud Gateway. + :type api_metadata_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: + :param cors_properties: Cross-Origin Resource Sharing property. + :type cors_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties + :param resource_requests: The requested resource quantity for required CPU and Memory. + :type resource_requests: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceRequests :ivar instances: Collection of instances belong to Spring Cloud Gateway. :vartype instances: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayInstance] @@ -4316,31 +3658,14 @@ class GatewayProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = False, - https_only: Optional[bool] = False, + public: Optional[bool] = None, + https_only: Optional[bool] = None, sso_properties: Optional["SsoProperties"] = None, api_metadata_properties: Optional["GatewayApiMetadataProperties"] = None, cors_properties: Optional["GatewayCorsProperties"] = None, resource_requests: Optional["GatewayResourceRequests"] = None, **kwargs ): - """ - :keyword public: Indicates whether the Spring Cloud Gateway exposes endpoint. - :paramtype public: bool - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCorsProperties - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceRequests - """ super(GatewayProperties, self).__init__(**kwargs) self.provisioning_state = None self.public = public @@ -4367,10 +3692,10 @@ class GatewayResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :param properties: Spring Cloud Gateway properties payload. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties + :param sku: Sku of the Spring Cloud Gateway resource. + :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -4396,12 +3721,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku - """ super(GatewayResource, self).__init__(**kwargs) self.properties = properties self.sku = sku @@ -4410,11 +3729,11 @@ def __init__( class GatewayResourceCollection(msrest.serialization.Model): """Object that includes an array of gateway resources and a possible link for next set. - :ivar value: Collection of gateway resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of gateway resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -4429,13 +3748,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(GatewayResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4444,10 +3756,10 @@ def __init__( class GatewayResourceRequests(msrest.serialization.Model): """Resource request payload of Spring Cloud Gateway. - :ivar cpu: Cpu allocated to each Spring Cloud Gateway instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Spring Cloud Gateway instance. - :vartype memory: str + :param cpu: Cpu allocated to each Spring Cloud Gateway instance. + :type cpu: str + :param memory: Memory allocated to each Spring Cloud Gateway instance. + :type memory: str """ _attribute_map = { @@ -4462,12 +3774,6 @@ def __init__( memory: Optional[str] = None, **kwargs ): - """ - :keyword cpu: Cpu allocated to each Spring Cloud Gateway instance. - :paramtype cpu: str - :keyword memory: Memory allocated to each Spring Cloud Gateway instance. - :paramtype memory: str - """ super(GatewayResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -4482,12 +3788,12 @@ class GatewayRouteConfigProperties(msrest.serialization.Model): include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route + :param app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route defines ``uri``. - :vartype app_resource_id: str - :ivar routes: Array of API routes, each route contains properties such as ``title``\ , ``uri``\ - , ``ssoEnabled``\ , ``predicates``\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] + :type app_resource_id: str + :param routes: Array of API routes, each route contains properties such as ``title``\ , + ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. + :type routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] """ _validation = { @@ -4507,14 +3813,6 @@ def __init__( routes: Optional[List["GatewayApiRoute"]] = None, **kwargs ): - """ - :keyword app_resource_id: The resource Id of the Azure Spring Cloud app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword routes: Array of API routes, each route contains properties such as ``title``\ , - ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayApiRoute] - """ super(GatewayRouteConfigProperties, self).__init__(**kwargs) self.provisioning_state = None self.app_resource_id = app_resource_id @@ -4534,8 +3832,8 @@ class GatewayRouteConfigResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: + :param properties: API route config of the Spring Cloud Gateway. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigProperties """ @@ -4560,11 +3858,6 @@ def __init__( properties: Optional["GatewayRouteConfigProperties"] = None, **kwargs ): - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigProperties - """ super(GatewayRouteConfigResource, self).__init__(**kwargs) self.properties = properties @@ -4572,12 +3865,12 @@ def __init__( class GatewayRouteConfigResourceCollection(msrest.serialization.Model): """Object that includes an array of Spring Cloud Gateway route config resources and a possible link for next set. - :ivar value: Collection of Spring Cloud Gateway route config resources. - :vartype value: + :param value: Collection of Spring Cloud Gateway route config resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -4592,14 +3885,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(GatewayRouteConfigResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4610,28 +3895,28 @@ class GitPatternRepository(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool + :param name: Required. Name of the repository. + :type name: str + :param pattern: Collection of pattern of the repository. + :type pattern: list[str] + :param uri: Required. URI of the repository. + :type uri: str + :param label: Label of the repository. + :type label: str + :param search_paths: Searching path of the repository. + :type search_paths: list[str] + :param username: Username of git repository basic auth. + :type username: str + :param password: Password of git repository basic auth. + :type password: str + :param host_key: Public sshKey of git repository. + :type host_key: str + :param host_key_algorithm: SshKey algorithm of git repository. + :type host_key_algorithm: str + :param private_key: Private sshKey algorithm of git repository. + :type private_key: str + :param strict_host_key_checking: Strict host key checking or not. + :type strict_host_key_checking: bool """ _validation = { @@ -4669,30 +3954,6 @@ def __init__( strict_host_key_checking: Optional[bool] = None, **kwargs ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ super(GitPatternRepository, self).__init__(**kwargs) self.name = name self.pattern = pattern @@ -4710,10 +3971,10 @@ def __init__( class ImageRegistryCredential(msrest.serialization.Model): """Credential of the image registry. - :ivar username: The username of the image registry credential. - :vartype username: str - :ivar password: The password of the image registry credential. - :vartype password: str + :param username: The username of the image registry credential. + :type username: str + :param password: The password of the image registry credential. + :type password: str """ _attribute_map = { @@ -4728,12 +3989,6 @@ def __init__( password: Optional[str] = None, **kwargs ): - """ - :keyword username: The username of the image registry credential. - :paramtype username: str - :keyword password: The password of the image registry credential. - :paramtype password: str - """ super(ImageRegistryCredential, self).__init__(**kwargs) self.username = username self.password = password @@ -4747,12 +4002,12 @@ class UploadedUserSourceInfo(UserSourceInfo): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str + :param type: Required. Type of the source uploaded.Constant filled by server. + :type type: str + :param version: Version of the source. + :type version: str + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str """ _validation = { @@ -4776,12 +4031,6 @@ def __init__( relative_path: Optional[str] = None, **kwargs ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - """ super(UploadedUserSourceInfo, self).__init__(version=version, **kwargs) self.type = 'UploadedUserSourceInfo' # type: str self.relative_path = relative_path @@ -4792,16 +4041,16 @@ class JarUploadedUserSourceInfo(UploadedUserSourceInfo): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar runtime_version: Runtime version of the Jar file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str + :param type: Required. Type of the source uploaded.Constant filled by server. + :type type: str + :param version: Version of the source. + :type version: str + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str + :param runtime_version: Runtime version of the Jar file. + :type runtime_version: str + :param jvm_options: Runtime version of the Jar file. + :type jvm_options: str """ _validation = { @@ -4825,17 +4074,7 @@ def __init__( jvm_options: Optional[str] = None, **kwargs ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword runtime_version: Runtime version of the Jar file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - """ - super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) + super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, jvm_options=jvm_options, **kwargs) self.type = 'Jar' # type: str self.runtime_version = runtime_version self.jvm_options = jvm_options @@ -4848,8 +4087,8 @@ class KeyVaultCertificateProperties(CertificateProperties): All required parameters must be populated in order to send to Azure. - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str + :param type: Required. The type of the certificate source.Constant filled by server. + :type type: str :ivar thumbprint: The thumbprint of certificate. :vartype thumbprint: str :ivar issuer: The issuer of certificate. @@ -4864,15 +4103,15 @@ class KeyVaultCertificateProperties(CertificateProperties): :vartype subject_name: str :ivar dns_names: The domain list of certificate. :vartype dns_names: list[str] - :ivar vault_uri: Required. The vault uri of user key vault. - :vartype vault_uri: str - :ivar key_vault_cert_name: Required. The certificate name of key vault. - :vartype key_vault_cert_name: str - :ivar cert_version: The certificate version of key vault. - :vartype cert_version: str - :ivar exclude_private_key: Optional. If set to true, it will not import private key from key + :param vault_uri: Required. The vault uri of user key vault. + :type vault_uri: str + :param key_vault_cert_name: Required. The certificate name of key vault. + :type key_vault_cert_name: str + :param cert_version: The certificate version of key vault. + :type cert_version: str + :param exclude_private_key: Optional. If set to true, it will not import private key from key vault. - :vartype exclude_private_key: bool + :type exclude_private_key: bool """ _validation = { @@ -4912,17 +4151,6 @@ def __init__( exclude_private_key: Optional[bool] = False, **kwargs ): - """ - :keyword vault_uri: Required. The vault uri of user key vault. - :paramtype vault_uri: str - :keyword key_vault_cert_name: Required. The certificate name of key vault. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - :keyword exclude_private_key: Optional. If set to true, it will not import private key from key - vault. - :paramtype exclude_private_key: bool - """ super(KeyVaultCertificateProperties, self).__init__(**kwargs) self.type = 'KeyVaultCertificate' # type: str self.vault_uri = vault_uri @@ -4936,11 +4164,11 @@ class LoadedCertificate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar resource_id: Required. Resource Id of loaded certificate. - :vartype resource_id: str - :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust + :param resource_id: Required. Resource Id of loaded certificate. + :type resource_id: str + :param load_trust_store: Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. - :vartype load_trust_store: bool + :type load_trust_store: bool """ _validation = { @@ -4959,13 +4187,6 @@ def __init__( load_trust_store: Optional[bool] = False, **kwargs ): - """ - :keyword resource_id: Required. Resource Id of loaded certificate. - :paramtype resource_id: str - :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust - store, only work for Java runtime. - :paramtype load_trust_store: bool - """ super(LoadedCertificate, self).__init__(**kwargs) self.resource_id = resource_id self.load_trust_store = load_trust_store @@ -4976,8 +4197,8 @@ class LogFileUrlResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar url: Required. URL of the log file. - :vartype url: str + :param url: Required. URL of the log file. + :type url: str """ _validation = { @@ -4994,10 +4215,6 @@ def __init__( url: str, **kwargs ): - """ - :keyword url: Required. URL of the log file. - :paramtype url: str - """ super(LogFileUrlResponse, self).__init__(**kwargs) self.url = url @@ -5005,12 +4222,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str """ _attribute_map = { @@ -5027,14 +4244,6 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -5044,13 +4253,13 @@ def __init__( class ManagedIdentityProperties(msrest.serialization.Model): """Managed identity properties retrieved from ARM request headers. - :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", + :param type: Type of the managed identity. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id. - :vartype principal_id: str - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str + :type type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityType + :param principal_id: Principal Id. + :type principal_id: str + :param tenant_id: Tenant Id. + :type tenant_id: str """ _attribute_map = { @@ -5067,15 +4276,6 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): - """ - :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id. - :paramtype tenant_id: str - """ super(ManagedIdentityProperties, self).__init__(**kwargs) self.type = type self.principal_id = principal_id @@ -5085,13 +4285,13 @@ def __init__( class MetricDimension(msrest.serialization.Model): """Specifications of the Dimension of metrics. - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox + :param name: Name of the dimension. + :type name: str + :param display_name: Localized friendly display name of the dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox export scenario. - :vartype to_be_exported_for_shoebox: bool + :type to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -5108,15 +4308,6 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :paramtype to_be_exported_for_shoebox: bool - """ super(MetricDimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -5126,31 +4317,31 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Specifications of the Metrics for Azure Monitoring. - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only + :param name: Name of the metric. + :type name: str + :param display_name: Localized friendly display name of the metric. + :type display_name: str + :param display_description: Localized friendly description of the metric. + :type display_description: str + :param unit: Unit that makes sense for the metric. + :type unit: str + :param category: Name of the metric category that the metric belongs to. A metric can only belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, + :type category: str + :param aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time + :type aggregation_type: str + :param supported_aggregation_types: Supported aggregation types. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: Supported time grain types. + :type supported_time_grain_types: list[str] + :param fill_gap_with_zero: Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricDimension] - :ivar source_mdm_namespace: Name of the MDM namespace. Optional. - :vartype source_mdm_namespace: str + :type fill_gap_with_zero: bool + :param dimensions: Dimensions of the metric. + :type dimensions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricDimension] + :param source_mdm_namespace: Name of the MDM namespace. Optional. + :type source_mdm_namespace: str """ _attribute_map = { @@ -5183,33 +4374,6 @@ def __init__( source_mdm_namespace: Optional[str] = None, **kwargs ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -5233,20 +4397,20 @@ class MonitoringSettingProperties(msrest.serialization.Model): "NotAvailable", "Failed", "Succeeded", "Updating". :vartype provisioning_state: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error - :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated - since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate - if monitoringSettings enabled or not. - :vartype trace_enabled: bool - :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or - whitespace include empty will disable monitoringSettings. - :vartype app_insights_instrumentation_key: str - :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, + :param error: Error when apply Monitoring Setting changes. + :type error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error + :param trace_enabled: Indicates whether enable the trace functionality, which will be + deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey + to indicate if monitoringSettings enabled or not. + :type trace_enabled: bool + :param app_insights_instrumentation_key: Target application insight instrumentation key, null + or whitespace include empty will disable monitoringSettings. + :type app_insights_instrumentation_key: str + :param app_insights_sampling_rate: Indicates the sampling rate of application insight agent, should be in range [0.0, 100.0]. - :vartype app_insights_sampling_rate: float - :ivar app_insights_agent_versions: Indicates the versions of application insight agent. - :vartype app_insights_agent_versions: + :type app_insights_sampling_rate: float + :param app_insights_agent_versions: Indicates the versions of application insight agent. + :type app_insights_agent_versions: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApplicationInsightsAgentVersions """ @@ -5274,23 +4438,6 @@ def __init__( app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, **kwargs ): - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Error - :keyword trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :paramtype trace_enabled: bool - :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :paramtype app_insights_instrumentation_key: str - :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :paramtype app_insights_sampling_rate: float - :keyword app_insights_agent_versions: Indicates the versions of application insight agent. - :paramtype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApplicationInsightsAgentVersions - """ super(MonitoringSettingProperties, self).__init__(**kwargs) self.provisioning_state = None self.error = error @@ -5313,8 +4460,8 @@ class MonitoringSettingResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: + :param properties: Properties of the Monitoring Setting resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingProperties """ @@ -5339,11 +4486,6 @@ def __init__( properties: Optional["MonitoringSettingProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingProperties - """ super(MonitoringSettingResource, self).__init__(**kwargs) self.properties = properties @@ -5351,12 +4493,12 @@ def __init__( class NameAvailability(msrest.serialization.Model): """Name availability result payload. - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: Reason why the name is not available. - :vartype reason: str - :ivar message: Message why the name is not available. - :vartype message: str + :param name_available: Indicates whether the name is available. + :type name_available: bool + :param reason: Reason why the name is not available. + :type reason: str + :param message: Message why the name is not available. + :type message: str """ _attribute_map = { @@ -5373,14 +4515,6 @@ def __init__( message: Optional[str] = None, **kwargs ): - """ - :keyword name_available: Indicates whether the name is available. - :paramtype name_available: bool - :keyword reason: Reason why the name is not available. - :paramtype reason: str - :keyword message: Message why the name is not available. - :paramtype message: str - """ super(NameAvailability, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -5392,10 +4526,10 @@ class NameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the resource to check name availability. - :vartype type: str - :ivar name: Required. Name to be checked. - :vartype name: str + :param type: Required. Type of the resource to check name availability. + :type type: str + :param name: Required. Name to be checked. + :type name: str """ _validation = { @@ -5415,12 +4549,6 @@ def __init__( name: str, **kwargs ): - """ - :keyword type: Required. Type of the resource to check name availability. - :paramtype type: str - :keyword name: Required. Name to be checked. - :paramtype name: str - """ super(NameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -5431,16 +4559,16 @@ class NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. - :vartype net_core_main_entry_path: str - :ivar runtime_version: Runtime version of the .Net file. - :vartype runtime_version: str + :param type: Required. Type of the source uploaded.Constant filled by server. + :type type: str + :param version: Version of the source. + :type version: str + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str + :param net_core_main_entry_path: The path to the .NET executable relative to zip root. + :type net_core_main_entry_path: str + :param runtime_version: Runtime version of the .Net file. + :type runtime_version: str """ _validation = { @@ -5464,16 +4592,6 @@ def __init__( runtime_version: Optional[str] = None, **kwargs ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. - :paramtype net_core_main_entry_path: str - :keyword runtime_version: Runtime version of the .Net file. - :paramtype runtime_version: str - """ super(NetCoreZipUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) self.type = 'NetCoreZip' # type: str self.net_core_main_entry_path = net_core_main_entry_path @@ -5485,19 +4603,20 @@ class NetworkProfile(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring - Cloud Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Cloud service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network + :param service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure + Spring Cloud Service Runtime. + :type service_runtime_subnet_id: str + :param app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud + Apps. + :type app_subnet_id: str + :param service_cidr: Azure Spring Cloud service reserved CIDR. + :type service_cidr: str + :param service_runtime_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources of + :type service_runtime_network_resource_group: str + :param app_network_resource_group: Name of the resource group containing network resources of Azure Spring Cloud Apps. - :vartype app_network_resource_group: str + :type app_network_resource_group: str :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Cloud instance. :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NetworkProfileOutboundIPs @@ -5531,22 +4650,6 @@ def __init__( app_network_resource_group: Optional[str] = None, **kwargs ): - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Cloud Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring Cloud - Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Cloud service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Cloud Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources of - Azure Spring Cloud Apps. - :paramtype app_network_resource_group: str - """ super(NetworkProfile, self).__init__(**kwargs) self.service_runtime_subnet_id = service_runtime_subnet_id self.app_subnet_id = app_subnet_id @@ -5578,8 +4681,6 @@ def __init__( self, **kwargs ): - """ - """ super(NetworkProfileOutboundIPs, self).__init__(**kwargs) self.public_i_ps = None @@ -5587,32 +4688,22 @@ def __init__( class OperationDetail(msrest.serialization.Model): """Operation detail payload. - Variables are only populated by the server, and will be ignored when sending a request. - - :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.appplatform.v2022_01_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationProperties + :param name: Name of the operation. + :type name: str + :param is_data_action: Indicates whether the operation is a data action. + :type is_data_action: bool + :param display: Display of the operation. + :type display: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationDisplay + :param origin: Origin of the operation. + :type origin: str + :param properties: Properties of the operation. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationProperties """ - _validation = { - 'action_type': {'readonly': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, 'origin': {'key': 'origin', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'OperationProperties'}, } @@ -5627,23 +4718,10 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): - """ - :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.appplatform.v2022_01_01_preview.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.OperationProperties - """ super(OperationDetail, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action self.display = display - self.action_type = None self.origin = origin self.properties = properties @@ -5651,14 +4729,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Operation display payload. - :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 + :param provider: Resource provider of the operation. + :type provider: str + :param resource: Resource of the operation. + :type resource: str + :param operation: Localized friendly name for the operation. + :type operation: str + :param description: Localized friendly description for the operation. + :type description: str """ _attribute_map = { @@ -5677,16 +4755,6 @@ def __init__( description: Optional[str] = None, **kwargs ): - """ - :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(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -5697,8 +4765,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Extra Operation properties. - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: + :param service_specification: Service specifications of the operation. + :type service_specification: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceSpecification """ @@ -5712,11 +4780,6 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceSpecification - """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -5726,12 +4789,12 @@ class PersistentDisk(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar size_in_gb: Size of the persistent disk in GB. - :vartype size_in_gb: int + :param size_in_gb: Size of the persistent disk in GB. + :type size_in_gb: int :ivar used_in_gb: Size of the used persistent disk in GB. :vartype used_in_gb: int - :ivar mount_path: Mount path of the persistent disk. - :vartype mount_path: str + :param mount_path: Mount path of the persistent disk. + :type mount_path: str """ _validation = { @@ -5752,12 +4815,6 @@ def __init__( mount_path: Optional[str] = None, **kwargs ): - """ - :keyword size_in_gb: Size of the persistent disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the persistent disk. - :paramtype mount_path: str - """ super(PersistentDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.used_in_gb = None @@ -5769,9 +4826,9 @@ class RegenerateTestKeyRequestPayload(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar key_type: Required. Type of the test key. Possible values include: "Primary", + :param key_type: Required. Type of the test key. Possible values include: "Primary", "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeyType + :type key_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeyType """ _validation = { @@ -5788,11 +4845,6 @@ def __init__( key_type: Union[str, "TestKeyType"], **kwargs ): - """ - :keyword key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeyType - """ super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) self.key_type = key_type @@ -5835,8 +4887,6 @@ def __init__( self, **kwargs ): - """ - """ super(RequiredTraffic, self).__init__(**kwargs) self.protocol = None self.port = None @@ -5848,12 +4898,12 @@ def __init__( class ResourceRequests(msrest.serialization.Model): """Deployment resource request payload. - :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for + :param cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :vartype cpu: str - :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, - 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :vartype memory: str + :type cpu: str + :param memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be + {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. + :type memory: str """ _attribute_map = { @@ -5868,14 +4918,6 @@ def __init__( memory: Optional[str] = None, **kwargs ): - """ - :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 - for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :paramtype cpu: str - :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :paramtype memory: str - """ super(ResourceRequests, self).__init__(**kwargs) self.cpu = cpu self.memory = memory @@ -5884,23 +4926,23 @@ def __init__( class ResourceSku(msrest.serialization.Model): """Describes an available Azure Spring Cloud SKU. - :ivar resource_type: Gets the type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: Gets the name of SKU. - :vartype name: str - :ivar tier: Gets the tier of SKU. - :vartype tier: str - :ivar capacity: Gets the capacity of SKU. - :vartype capacity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuCapacity - :ivar locations: Gets the set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Gets a list of locations and availability zones in those locations where + :param resource_type: Gets the type of resource the SKU applies to. + :type resource_type: str + :param name: Gets the name of SKU. + :type name: str + :param tier: Gets the tier of SKU. + :type tier: str + :param capacity: Gets the capacity of SKU. + :type capacity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuCapacity + :param locations: Gets the set of locations that the SKU is available. + :type locations: list[str] + :param location_info: Gets a list of locations and availability zones in those locations where the SKU is available. - :vartype location_info: + :type location_info: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuLocationInfo] - :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is + :param restrictions: Gets the restrictions because of which SKU cannot be used. This is empty if there are no restrictions. - :vartype restrictions: + :type restrictions: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictions] """ @@ -5926,26 +4968,6 @@ def __init__( restrictions: Optional[List["ResourceSkuRestrictions"]] = None, **kwargs ): - """ - :keyword resource_type: Gets the type of resource the SKU applies to. - :paramtype resource_type: str - :keyword name: Gets the name of SKU. - :paramtype name: str - :keyword tier: Gets the tier of SKU. - :paramtype tier: str - :keyword capacity: Gets the capacity of SKU. - :paramtype capacity: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuCapacity - :keyword locations: Gets the set of locations that the SKU is available. - :paramtype locations: list[str] - :keyword location_info: Gets a list of locations and availability zones in those locations - where the SKU is available. - :paramtype location_info: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuLocationInfo] - :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :paramtype restrictions: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictions] - """ super(ResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.name = name @@ -5959,10 +4981,10 @@ def __init__( class ResourceSkuCapabilities(msrest.serialization.Model): """ResourceSkuCapabilities. - :ivar name: Gets an invariant to describe the feature. - :vartype name: str - :ivar value: Gets an invariant if the feature is measured by quantity. - :vartype value: str + :param name: Gets an invariant to describe the feature. + :type name: str + :param value: Gets an invariant if the feature is measured by quantity. + :type value: str """ _attribute_map = { @@ -5977,12 +4999,6 @@ def __init__( value: Optional[str] = None, **kwargs ): - """ - :keyword name: Gets an invariant to describe the feature. - :paramtype name: str - :keyword value: Gets an invariant if the feature is measured by quantity. - :paramtype value: str - """ super(ResourceSkuCapabilities, self).__init__(**kwargs) self.name = name self.value = value @@ -5991,11 +5007,11 @@ def __init__( class ResourceSkuCollection(msrest.serialization.Model): """Object that includes an array of Azure Spring Cloud SKU and a possible link for next set. - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of resource SKU. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -6010,13 +5026,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSku] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ResourceSkuCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6025,12 +5034,12 @@ def __init__( class ResourceSkuLocationInfo(msrest.serialization.Model): """Locations and availability zones where the SKU is available. - :ivar location: Gets location of the SKU. - :vartype location: str - :ivar zones: Gets list of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. - :vartype zone_details: + :param location: Gets location of the SKU. + :type location: str + :param zones: Gets list of availability zones where the SKU is supported. + :type zones: list[str] + :param zone_details: Gets details of capabilities available to a SKU in specific zones. + :type zone_details: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuZoneDetails] """ @@ -6048,15 +5057,6 @@ def __init__( zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, **kwargs ): - """ - :keyword location: Gets location of the SKU. - :paramtype location: str - :keyword zones: Gets list of availability zones where the SKU is supported. - :paramtype zones: list[str] - :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. - :paramtype zone_details: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuZoneDetails] - """ super(ResourceSkuLocationInfo, self).__init__(**kwargs) self.location = location self.zones = zones @@ -6066,10 +5066,10 @@ def __init__( class ResourceSkuRestrictionInfo(msrest.serialization.Model): """Information about the restriction where the SKU cannot be used. - :ivar locations: Gets locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: Gets list of availability zones where the SKU is restricted. - :vartype zones: list[str] + :param locations: Gets locations where the SKU is restricted. + :type locations: list[str] + :param zones: Gets list of availability zones where the SKU is restricted. + :type zones: list[str] """ _attribute_map = { @@ -6084,12 +5084,6 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): - """ - :keyword locations: Gets locations where the SKU is restricted. - :paramtype locations: list[str] - :keyword zones: Gets list of availability zones where the SKU is restricted. - :paramtype zones: list[str] - """ super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) self.locations = locations self.zones = zones @@ -6098,21 +5092,21 @@ def __init__( class ResourceSkuRestrictions(msrest.serialization.Model): """Restrictions where the SKU cannot be used. - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. + :param type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. Possible values include: "Location", "Zone". - :vartype type: str or + :type type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsType - :ivar values: Gets the value of restrictions. If the restriction type is set to + :param values: Gets the value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: Gets the information about the restriction where the SKU cannot be + :type values: list[str] + :param restriction_info: Gets the information about the restriction where the SKU cannot be used. - :vartype restriction_info: + :type restriction_info: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', + :param reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', 'NotAvailableForSubscription'. Possible values include: "QuotaId", "NotAvailableForSubscription". - :vartype reason_code: str or + :type reason_code: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsReasonCode """ @@ -6132,24 +5126,6 @@ def __init__( reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, **kwargs ): - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsType - :keyword values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :paramtype values: list[str] - :keyword restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :paramtype restriction_info: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuRestrictionsReasonCode - """ super(ResourceSkuRestrictions, self).__init__(**kwargs) self.type = type self.values = values @@ -6160,12 +5136,12 @@ def __init__( class ResourceSkuZoneDetails(msrest.serialization.Model): """Details of capabilities available to a SKU in specific zones. - :ivar name: Gets the set of zones that the SKU is available in with the + :param name: Gets the set of zones that the SKU is available in with the specified capabilities. - :vartype name: list[str] - :ivar capabilities: Gets a list of capabilities that are available for the SKU in the + :type name: list[str] + :param capabilities: Gets a list of capabilities that are available for the SKU in the specified list of zones. - :vartype capabilities: + :type capabilities: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCapabilities] """ @@ -6181,15 +5157,6 @@ def __init__( capabilities: Optional[List["ResourceSkuCapabilities"]] = None, **kwargs ): - """ - :keyword name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :paramtype name: list[str] - :keyword capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :paramtype capabilities: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCapabilities] - """ super(ResourceSkuZoneDetails, self).__init__(**kwargs) self.name = name self.capabilities = capabilities @@ -6198,10 +5165,10 @@ def __init__( class ResourceUploadDefinition(msrest.serialization.Model): """Resource upload definition payload. - :ivar relative_path: Source relative path. - :vartype relative_path: str - :ivar upload_url: Upload URL. - :vartype upload_url: str + :param relative_path: Source relative path. + :type relative_path: str + :param upload_url: Upload URL. + :type upload_url: str """ _attribute_map = { @@ -6216,12 +5183,6 @@ def __init__( upload_url: Optional[str] = None, **kwargs ): - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ super(ResourceUploadDefinition, self).__init__(**kwargs) self.relative_path = relative_path self.upload_url = upload_url @@ -6252,8 +5213,6 @@ def __init__( self, **kwargs ): - """ - """ super(ServiceRegistryInstance, self).__init__(**kwargs) self.name = None self.status = None @@ -6292,8 +5251,6 @@ def __init__( self, **kwargs ): - """ - """ super(ServiceRegistryProperties, self).__init__(**kwargs) self.provisioning_state = None self.resource_requests = None @@ -6313,9 +5270,8 @@ class ServiceRegistryResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties + :param properties: Service Registry properties payload. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties """ _validation = { @@ -6339,11 +5295,6 @@ def __init__( properties: Optional["ServiceRegistryProperties"] = None, **kwargs ): - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryProperties - """ super(ServiceRegistryResource, self).__init__(**kwargs) self.properties = properties @@ -6351,12 +5302,11 @@ def __init__( class ServiceRegistryResourceCollection(msrest.serialization.Model): """Object that includes an array of Service Registry resources and a possible link for next set. - :ivar value: Collection of Service Registry resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Service Registry resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -6371,14 +5321,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ServiceRegistryResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6413,8 +5355,6 @@ def __init__( self, **kwargs ): - """ - """ super(ServiceRegistryResourceRequests, self).__init__(**kwargs) self.cpu = None self.memory = None @@ -6434,11 +5374,11 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] """ _validation = { @@ -6464,13 +5404,6 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - """ super(TrackedResource, self).__init__(**kwargs) self.location = location self.tags = tags @@ -6489,16 +5422,15 @@ class ServiceResource(TrackedResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the Service resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku + :param location: The GEO location of the resource. + :type location: str + :param tags: A set of tags. Tags of the service which is a list of key value pairs that + describe the resource. + :type tags: dict[str, str] + :param properties: Properties of the Service resource. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ClusterResourceProperties + :param sku: Sku of the Service resource. + :type sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku """ _validation = { @@ -6528,18 +5460,6 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the Service resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_01_01_preview.models.Sku - """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -6548,11 +5468,11 @@ def __init__( class ServiceResourceList(msrest.serialization.Model): """Object that includes an array of Service resources and a possible link for next set. - :ivar value: Collection of Service resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of Service resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -6567,13 +5487,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6582,11 +5495,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: + :param metric_specifications: Specifications of the Metrics for Azure Monitoring. + :type metric_specifications: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricSpecification] """ @@ -6602,14 +5515,6 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.MetricSpecification] - """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -6618,12 +5523,12 @@ def __init__( class Sku(msrest.serialization.Model): """Sku of Azure Spring Cloud. - :ivar name: Name of the Sku. - :vartype name: str - :ivar tier: Tier of the Sku. - :vartype tier: str - :ivar capacity: Current capacity of the target resource. - :vartype capacity: int + :param name: Name of the Sku. + :type name: str + :param tier: Tier of the Sku. + :type tier: str + :param capacity: Current capacity of the target resource. + :type capacity: int """ _attribute_map = { @@ -6640,14 +5545,6 @@ def __init__( capacity: Optional[int] = None, **kwargs ): - """ - :keyword name: Name of the Sku. - :paramtype name: str - :keyword tier: Tier of the Sku. - :paramtype tier: str - :keyword capacity: Current capacity of the target resource. - :paramtype capacity: int - """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -6659,15 +5556,15 @@ class SkuCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar minimum: Required. Gets or sets the minimum. - :vartype minimum: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar default: Gets or sets the default. - :vartype default: int - :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", + :param minimum: Required. Gets or sets the minimum. + :type minimum: int + :param maximum: Gets or sets the maximum. + :type maximum: int + :param default: Gets or sets the default. + :type default: int + :param scale_type: Gets or sets the type of the scale. Possible values include: "None", "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuScaleType + :type scale_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuScaleType """ _validation = { @@ -6690,17 +5587,6 @@ def __init__( scale_type: Optional[Union[str, "SkuScaleType"]] = None, **kwargs ): - """ - :keyword minimum: Required. Gets or sets the minimum. - :paramtype minimum: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword default: Gets or sets the default. - :paramtype default: int - :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SkuScaleType - """ super(SkuCapacity, self).__init__(**kwargs) self.minimum = minimum self.maximum = maximum @@ -6713,18 +5599,18 @@ class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): All required parameters must be populated in order to send to Azure. - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar artifact_selector: Selector for the artifact to be used for the deployment for + :param type: Required. Type of the source uploaded.Constant filled by server. + :type type: str + :param version: Version of the source. + :type version: str + :param relative_path: Relative path of the storage which stores the source. + :type relative_path: str + :param artifact_selector: Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. - :vartype artifact_selector: str - :ivar runtime_version: Runtime version of the source file. - :vartype runtime_version: str + :type artifact_selector: str + :param runtime_version: Runtime version of the source file. + :type runtime_version: str """ _validation = { @@ -6748,18 +5634,6 @@ def __init__( runtime_version: Optional[str] = None, **kwargs ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :paramtype artifact_selector: str - :keyword runtime_version: Runtime version of the source file. - :paramtype runtime_version: str - """ super(SourceUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) self.type = 'Source' # type: str self.artifact_selector = artifact_selector @@ -6769,15 +5643,15 @@ def __init__( class SsoProperties(msrest.serialization.Model): """Single sign-on related configuration. - :ivar scope: It defines the specific actions applications can be allowed to do on a user's + :param scope: It defines the specific actions applications can be allowed to do on a user's behalf. - :vartype scope: list[str] - :ivar client_id: The public identifier for the application. - :vartype client_id: str - :ivar client_secret: The secret known only to the application and the authorization server. - :vartype client_secret: str - :ivar issuer_uri: The URI of Issuer Identifier. - :vartype issuer_uri: str + :type scope: list[str] + :param client_id: The public identifier for the application. + :type client_id: str + :param client_secret: The secret known only to the application and the authorization server. + :type client_secret: str + :param issuer_uri: The URI of Issuer Identifier. + :type issuer_uri: str """ _attribute_map = { @@ -6796,17 +5670,6 @@ def __init__( issuer_uri: Optional[str] = None, **kwargs ): - """ - :keyword scope: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scope: list[str] - :keyword client_id: The public identifier for the application. - :paramtype client_id: str - :keyword client_secret: The secret known only to the application and the authorization server. - :paramtype client_secret: str - :keyword issuer_uri: The URI of Issuer Identifier. - :paramtype issuer_uri: str - """ super(SsoProperties, self).__init__(**kwargs) self.scope = scope self.client_id = client_id @@ -6817,10 +5680,10 @@ def __init__( class StackProperties(msrest.serialization.Model): """KPack ClusterStack properties payload. - :ivar id: Id of the ClusterStack. - :vartype id: str - :ivar version: Version of the ClusterStack. - :vartype version: str + :param id: Id of the ClusterStack. + :type id: str + :param version: Version of the ClusterStack. + :type version: str """ _attribute_map = { @@ -6835,12 +5698,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ super(StackProperties, self).__init__(**kwargs) self.id = id self.version = version @@ -6854,9 +5711,8 @@ class StorageProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageType + :param storage_type: Required. The type of the storage.Constant filled by server. + :type storage_type: str """ _validation = { @@ -6875,8 +5731,6 @@ def __init__( self, **kwargs ): - """ - """ super(StorageProperties, self).__init__(**kwargs) self.storage_type = None # type: Optional[str] @@ -6886,13 +5740,12 @@ class StorageAccount(StorageProperties): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageType - :ivar account_name: Required. The account name of the Azure Storage Account. - :vartype account_name: str - :ivar account_key: Required. The account key of the Azure Storage Account. - :vartype account_key: str + :param storage_type: Required. The type of the storage.Constant filled by server. + :type storage_type: str + :param account_name: Required. The account name of the Azure Storage Account. + :type account_name: str + :param account_key: Required. The account key of the Azure Storage Account. + :type account_key: str """ _validation = { @@ -6914,12 +5767,6 @@ def __init__( account_key: str, **kwargs ): - """ - :keyword account_name: Required. The account name of the Azure Storage Account. - :paramtype account_name: str - :keyword account_key: Required. The account key of the Azure Storage Account. - :paramtype account_key: str - """ super(StorageAccount, self).__init__(**kwargs) self.storage_type = 'StorageAccount' # type: str self.account_name = account_name @@ -6939,8 +5786,8 @@ class StorageResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties + :param properties: Properties of the storage resource payload. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties """ _validation = { @@ -6964,10 +5811,6 @@ def __init__( properties: Optional["StorageProperties"] = None, **kwargs ): - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageProperties - """ super(StorageResource, self).__init__(**kwargs) self.properties = properties @@ -6975,10 +5818,10 @@ def __init__( class StorageResourceCollection(msrest.serialization.Model): """Collection compose of storage resources list and a possible link for next page. - :ivar value: The storage resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str + :param value: The storage resources list. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] + :param next_link: The link to next page of storage list. + :type next_link: str """ _attribute_map = { @@ -6993,12 +5836,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ super(StorageResourceCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7017,8 +5854,8 @@ class SupportedBuildpackResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: + :param properties: Supported buildpack resource properties. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResourceProperties """ @@ -7043,11 +5880,6 @@ def __init__( properties: Optional["SupportedBuildpackResourceProperties"] = None, **kwargs ): - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResourceProperties - """ super(SupportedBuildpackResource, self).__init__(**kwargs) self.properties = properties @@ -7055,8 +5887,8 @@ def __init__( class SupportedBuildpackResourceProperties(msrest.serialization.Model): """Supported buildpack resource properties. - :ivar buildpack_id: The id of supported buildpack. - :vartype buildpack_id: str + :param buildpack_id: The id of supported buildpack. + :type buildpack_id: str """ _attribute_map = { @@ -7069,10 +5901,6 @@ def __init__( buildpack_id: Optional[str] = None, **kwargs ): - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ super(SupportedBuildpackResourceProperties, self).__init__(**kwargs) self.buildpack_id = buildpack_id @@ -7080,12 +5908,12 @@ def __init__( class SupportedBuildpacksCollection(msrest.serialization.Model): """Object that includes an array of supported buildpacks resources and a possible link for next set. - :ivar value: Collection of supported buildpacks resources. - :vartype value: + :param value: Collection of supported buildpacks resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -7100,14 +5928,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedBuildpackResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(SupportedBuildpacksCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7116,15 +5936,15 @@ def __init__( class SupportedRuntimeVersion(msrest.serialization.Model): """Supported deployment runtime version descriptor. - :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values - include: "Java_8", "Java_11", "Java_17", "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). + :param value: The raw value which could be passed to deployment CRUD operations. Possible + values include: "Java_8", "Java_11", "Java_17", "NetCore_31". + :type value: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimeValue + :param platform: The platform of this runtime version (possible values: "Java" or ".NET"). Possible values include: "Java", ".NET Core". - :vartype platform: str or + :type platform: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimePlatform - :ivar version: The detailed version (major.minor) of the platform. - :vartype version: str + :param version: The detailed version (major.minor) of the platform. + :type version: str """ _attribute_map = { @@ -7141,18 +5961,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "Java_17", "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ super(SupportedRuntimeVersion, self).__init__(**kwargs) self.value = value self.platform = platform @@ -7172,8 +5980,8 @@ class SupportedStackResource(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: + :param properties: Supported stack resource properties. + :type properties: ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResourceProperties """ @@ -7198,11 +6006,6 @@ def __init__( properties: Optional["SupportedStackResourceProperties"] = None, **kwargs ): - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResourceProperties - """ super(SupportedStackResource, self).__init__(**kwargs) self.properties = properties @@ -7210,10 +6013,10 @@ def __init__( class SupportedStackResourceProperties(msrest.serialization.Model): """Supported stack resource properties. - :ivar stack_id: The id of supported stack. - :vartype stack_id: str - :ivar version: The version of supported stack. - :vartype version: str + :param stack_id: The id of supported stack. + :type stack_id: str + :param version: The version of supported stack. + :type version: str """ _attribute_map = { @@ -7228,12 +6031,6 @@ def __init__( version: Optional[str] = None, **kwargs ): - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ super(SupportedStackResourceProperties, self).__init__(**kwargs) self.stack_id = stack_id self.version = version @@ -7242,11 +6039,11 @@ def __init__( class SupportedStacksCollection(msrest.serialization.Model): """Object that includes an array of supported stacks resources and a possible link for next set. - :ivar value: Collection of supported stacks resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). + :param value: Collection of supported stacks resources. + :type value: list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] + :param next_link: URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - :vartype next_link: str + :type next_link: str """ _attribute_map = { @@ -7261,14 +6058,6 @@ def __init__( next_link: Optional[str] = None, **kwargs ): - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_01_01_preview.models.SupportedStackResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ super(SupportedStacksCollection, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -7277,22 +6066,21 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: - "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or + :type last_modified_by_type: str or ~azure.mgmt.appplatform.v2022_01_01_preview.models.LastModifiedByType - :ivar last_modified_at: The timestamp of resource modification (UTC). - :vartype last_modified_at: ~datetime.datetime + :param last_modified_at: The timestamp of resource modification (UTC). + :type last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -7315,24 +6103,6 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_01_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -7345,10 +6115,10 @@ def __init__( class TemporaryDisk(msrest.serialization.Model): """Temporary disk payload. - :ivar size_in_gb: Size of the temporary disk in GB. - :vartype size_in_gb: int - :ivar mount_path: Mount path of the temporary disk. - :vartype mount_path: str + :param size_in_gb: Size of the temporary disk in GB. + :type size_in_gb: int + :param mount_path: Mount path of the temporary disk. + :type mount_path: str """ _validation = { @@ -7367,12 +6137,6 @@ def __init__( mount_path: Optional[str] = "/tmp", **kwargs ): - """ - :keyword size_in_gb: Size of the temporary disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the temporary disk. - :paramtype mount_path: str - """ super(TemporaryDisk, self).__init__(**kwargs) self.size_in_gb = size_in_gb self.mount_path = mount_path @@ -7381,16 +6145,16 @@ def __init__( class TestKeys(msrest.serialization.Model): """Test keys payload. - :ivar primary_key: Primary key. - :vartype primary_key: str - :ivar secondary_key: Secondary key. - :vartype secondary_key: str - :ivar primary_test_endpoint: Primary test endpoint. - :vartype primary_test_endpoint: str - :ivar secondary_test_endpoint: Secondary test endpoint. - :vartype secondary_test_endpoint: str - :ivar enabled: Indicates whether the test endpoint feature enabled or not. - :vartype enabled: bool + :param primary_key: Primary key. + :type primary_key: str + :param secondary_key: Secondary key. + :type secondary_key: str + :param primary_test_endpoint: Primary test endpoint. + :type primary_test_endpoint: str + :param secondary_test_endpoint: Secondary test endpoint. + :type secondary_test_endpoint: str + :param enabled: Indicates whether the test endpoint feature enabled or not. + :type enabled: bool """ _attribute_map = { @@ -7411,18 +6175,6 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): - """ - :keyword primary_key: Primary key. - :paramtype primary_key: str - :keyword secondary_key: Secondary key. - :paramtype secondary_key: str - :keyword primary_test_endpoint: Primary test endpoint. - :paramtype primary_test_endpoint: str - :keyword secondary_test_endpoint: Secondary test endpoint. - :paramtype secondary_test_endpoint: str - :keyword enabled: Indicates whether the test endpoint feature enabled or not. - :paramtype enabled: bool - """ super(TestKeys, self).__init__(**kwargs) self.primary_key = primary_key self.secondary_key = secondary_key @@ -7434,8 +6186,8 @@ def __init__( class TriggeredBuildResult(msrest.serialization.Model): """The build result triggered by a build. - :ivar id: The unique build id of this build result. - :vartype id: str + :param id: The unique build id of this build result. + :type id: str """ _attribute_map = { @@ -7448,10 +6200,6 @@ def __init__( id: Optional[str] = None, **kwargs ): - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ super(TriggeredBuildResult, self).__init__(**kwargs) self.id = id @@ -7459,10 +6207,10 @@ def __init__( class ValidationMessages(msrest.serialization.Model): """Validate messages of the configuration service git repositories. - :ivar name: The name of the configuration service git repository. - :vartype name: str - :ivar messages: Detailed validation messages. - :vartype messages: list[str] + :param name: The name of the configuration service git repository. + :type name: str + :param messages: Detailed validation messages. + :type messages: list[str] """ _attribute_map = { @@ -7477,12 +6225,6 @@ def __init__( messages: Optional[List[str]] = None, **kwargs ): - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ super(ValidationMessages, self).__init__(**kwargs) self.name = name self.messages = messages diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py index 6ababcc56e8..b6ed0a08705 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portal_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,193 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ApiPortalCustomDomainsOperations(object): """ApiPortalCustomDomainsOperations operations. @@ -216,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.ApiPortalCustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ApiPortalCustomDomainResource" """Get the API portal custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -246,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -279,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", - **kwargs: Any - ) -> "_models.ApiPortalCustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + domain_name, # type: str + api_portal_custom_domain_resource, # type: "_models.ApiPortalCustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApiPortalCustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -338,20 +175,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.ApiPortalCustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + domain_name, # type: str + api_portal_custom_domain_resource, # type: "_models.ApiPortalCustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ApiPortalCustomDomainResource"] """Create or update the API portal custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -365,24 +200,17 @@ def begin_create_or_update( :type domain_name: str :param api_portal_custom_domain_resource: The API portal custom domain for the create or update operation. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource + :type api_portal_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( @@ -397,22 +225,29 @@ def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -422,44 +257,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -469,18 +308,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the API portal custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -494,17 +332,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -518,18 +353,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -539,18 +382,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApiPortalCustomDomainResourceCollection"] """Handle requests to list all API portal custom domains. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -561,50 +404,46 @@ def list( :param api_portal_name: The name of API portal. :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] + :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('ApiPortalCustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,11 +452,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -626,8 +461,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py index 4b3996956aa..ecc9e59c421 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_api_portals_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,231 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ApiPortalsOperations(object): """ApiPortalsOperations operations. @@ -254,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> "_models.ApiPortalResource": + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ApiPortalResource" """Get the API portal and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -281,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -313,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: "_models.ApiPortalResource", - **kwargs: Any - ) -> "_models.ApiPortalResource": + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + api_portal_resource, # type: "_models.ApiPortalResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApiPortalResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(api_portal_resource, 'ApiPortalResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -370,19 +169,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: "_models.ApiPortalResource", - **kwargs: Any - ) -> LROPoller["_models.ApiPortalResource"]: + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + api_portal_resource, # type: "_models.ApiPortalResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ApiPortalResource"] """Create the default API portal or update the existing API portal. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -396,20 +193,14 @@ def begin_create_or_update( :type api_portal_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ApiPortalResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( @@ -423,22 +214,28 @@ def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ApiPortalResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -448,42 +245,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -493,17 +294,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the default API portal. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -515,17 +315,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type api_portal_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -538,18 +335,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -559,17 +363,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ApiPortalResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApiPortalResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -578,48 +382,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] + :return: An iterator like instance of either ApiPortalResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) + deserialized = self._deserialize('ApiPortalResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -628,11 +429,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,21 +438,20 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore - @distributed_trace def validate_domain( self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": + resource_group_name, # type: str + service_name, # type: str + api_portal_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the domains are valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -666,8 +462,7 @@ def validate_domain( :param api_portal_name: The name of API portal. :type api_portal_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -678,30 +473,34 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'apiPortalName': self._serialize.url("api_portal_name", api_portal_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -714,6 +513,4 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py index 250f8853971..cf8312c0d7f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,365 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_active_deployments_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class AppsOperations(object): """AppsOperations operations. @@ -388,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + sync_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" """Get an App and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -406,7 +65,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -418,27 +77,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if sync_status is not None: + query_parameters['syncStatus'] = self._serialize.query("sync_status", sync_status, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -451,47 +114,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -511,19 +177,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Create a new App or update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -537,20 +201,14 @@ def begin_create_or_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -564,22 +222,28 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -589,42 +253,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -634,17 +302,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -656,17 +323,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -679,18 +343,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -700,47 +371,52 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(app_resource, 'AppResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -757,19 +433,17 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + app_resource, # type: "_models.AppResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Operation to update an exiting App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -783,20 +457,14 @@ def begin_update( :type app_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -810,22 +478,28 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -835,17 +509,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.AppResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AppResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -854,48 +528,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] + :return: An iterator like instance of either AppResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) + deserialized = self._deserialize('AppResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -904,11 +575,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -917,20 +584,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore - @distributed_trace def get_resource_upload_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" """Get an resource upload URL for an App, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -950,26 +616,29 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -982,47 +651,50 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore def _set_active_deployments_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> "_models.AppResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + active_deployment_collection, # type: "_models.ActiveDeploymentCollection" + **kwargs # type: Any + ): + # type: (...) -> "_models.AppResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - - request = build_set_active_deployments_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._set_active_deployments_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._set_active_deployments_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1039,19 +711,17 @@ def _set_active_deployments_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - - @distributed_trace def begin_set_active_deployments( self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + active_deployment_collection, # type: "_models.ActiveDeploymentCollection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AppResource"] """Set existing Deployment under the app as active. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1062,24 +732,17 @@ def begin_set_active_deployments( :param app_name: The name of the App resource. :type app_name: str :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection + :type active_deployment_collection: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ActiveDeploymentCollection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AppResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.AppResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( @@ -1093,22 +756,28 @@ def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('AppResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1118,19 +787,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - @distributed_trace def validate_domain( self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the resource name is valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1141,8 +810,7 @@ def validate_domain( :param app_name: The name of the App resource. :type app_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -1153,30 +821,34 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1189,6 +861,4 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py index 58353810710..391d0e2c7f9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BindingsOperations(object): """BindingsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" """Get a Binding and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Create a new Binding or update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(binding_resource, 'BindingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + binding_name, # type: str + binding_resource, # type: "_models.BindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BindingResource"] """Operation to update an exiting Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type binding_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'bindingName': self._serialize.url("binding_name", binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.BindingResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BindingResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] + :return: An iterator like instance of either BindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py index f08381a1a61..cf37e99c46c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_agent_pool_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,153 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BuildServiceAgentPoolOperations(object): """BuildServiceAgentPoolOperations operations. @@ -176,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"] """List build service agent pool. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -194,50 +65,46 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] + :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) + deserialized = self._deserialize('BuildServiceAgentPoolResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -246,11 +113,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -259,21 +122,20 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + agent_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BuildServiceAgentPoolResource" """Get build service agent pool. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -295,27 +157,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,49 +193,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + agent_pool_name, # type: str + pool_size, # type: "_models.BuildServiceAgentPoolSizeProperties" + **kwargs # type: Any + ): + # type: (...) -> "_models.BuildServiceAgentPoolResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(pool_size, 'BuildServiceAgentPoolSizeProperties') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -387,20 +255,18 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> LROPoller["_models.BuildServiceAgentPoolResource"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + agent_pool_name, # type: str + pool_size, # type: "_models.BuildServiceAgentPoolSizeProperties" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BuildServiceAgentPoolResource"] """Create or update build service agent pool. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -412,25 +278,18 @@ def begin_update_put( :type build_service_name: str :param agent_pool_name: The name of the build service agent pool resource. :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource + :param pool_size: Parameters for the update operation. + :type pool_size: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolSizeProperties :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceAgentPoolResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( @@ -444,23 +303,30 @@ def begin_update_put( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - agent_pool_resource=agent_pool_resource, - api_version=api_version, - content_type=content_type, + pool_size=pool_size, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'agentPoolName': self._serialize.url("agent_pool_name", agent_pool_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -470,6 +336,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py index 372456dce93..ddce0e2031d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_builder_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,193 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BuildServiceBuilderOperations(object): """BuildServiceBuilderOperations operations. @@ -216,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> "_models.BuilderResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BuilderResource" """Get a KPack builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -246,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -279,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> "_models.BuilderResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + builder_resource, # type: "_models.BuilderResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BuilderResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(builder_resource, 'BuilderResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(builder_resource, 'BuilderResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -338,20 +175,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> LROPoller["_models.BuilderResource"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + builder_resource, # type: "_models.BuilderResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BuilderResource"] """Create or update a KPack builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -367,20 +202,14 @@ def begin_create_or_update( :type builder_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BuilderResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( @@ -395,22 +224,29 @@ def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BuilderResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -420,44 +256,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -467,18 +307,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete a KPack builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -492,17 +331,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -516,18 +352,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -537,18 +381,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuilderResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BuilderResourceCollection"] """List KPack builders result. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -559,50 +403,46 @@ def list( :param build_service_name: The name of the build service resource. :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] + :return: An iterator like instance of either BuilderResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) + deserialized = self._deserialize('BuilderResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -611,11 +451,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -624,8 +460,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py index 30f21ac6634..fec8413533c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_build_service_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,543 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_build_services_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_service_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_builds_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_build_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_build_results_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_result_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_result_log_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_supported_buildpacks_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_supported_buildpack_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_supported_stacks_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_supported_stack_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BuildServiceOperations(object): """BuildServiceOperations operations. @@ -566,13 +45,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list_build_services( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildServiceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BuildServiceCollection"] """List build services resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -581,48 +60,45 @@ def list_build_services( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] + :return: An iterator like instance of either BuildServiceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_build_services.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_build_services.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceCollection", pipeline_response) + deserialized = self._deserialize('BuildServiceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -631,11 +107,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -644,20 +116,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore - @distributed_trace def get_build_service( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.BuildService": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BuildService" """Get a build service resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -677,26 +148,29 @@ def get_build_service( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build_service.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_build_service_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_build_service.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -709,18 +183,16 @@ def get_build_service( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore - - - @distributed_trace def list_builds( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildCollection"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BuildCollection"] """List KPack builds. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -732,48 +204,45 @@ def list_builds( :type build_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_builds.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_builds.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) + deserialized = self._deserialize('BuildCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -782,11 +251,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -795,21 +260,20 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore - @distributed_trace def get_build( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> "_models.Build": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + build_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Build" """Get a KPack build. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -831,27 +295,30 @@ def get_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.get_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -864,20 +331,18 @@ def get_build( return cls(pipeline_response, deserialized, {}) return deserialized + get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace def create_or_update_build( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: "_models.Build", - **kwargs: Any - ) -> "_models.Build": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + build_name, # type: str + build, # type: "_models.Build" + **kwargs # type: Any + ): + # type: (...) -> "_models.Build" """Create or update a KPack build. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -901,31 +366,35 @@ def create_or_update_build( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(build, 'Build') - - request = build_create_or_update_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update_build.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(build, 'Build') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -942,19 +411,17 @@ def create_or_update_build( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace def list_build_results( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildResultCollection"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + build_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BuildResultCollection"] """List KPack build results. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -967,52 +434,47 @@ def list_build_results( :param build_name: The name of the build resource. :type build_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] + :return: An iterator like instance of either BuildResultCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.list_build_results.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_build_results.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BuildResultCollection", pipeline_response) + deserialized = self._deserialize('BuildResultCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1021,11 +483,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1034,22 +492,21 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore - @distributed_trace def get_build_result( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResult": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + build_name, # type: str + build_result_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BuildResult" """Get a KPack build result. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1073,28 +530,31 @@ def get_build_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build_result.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_build_result_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1107,20 +567,18 @@ def get_build_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore - - - @distributed_trace def get_build_result_log( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResultLog": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + build_name, # type: str + build_result_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BuildResultLog" """Get a KPack build result log download URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1144,28 +602,31 @@ def get_build_result_log( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_build_result_log.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildName': self._serialize.url("build_name", build_name, 'str'), + 'buildResultName': self._serialize.url("build_result_name", build_result_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_build_result_log_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result_log.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1178,18 +639,16 @@ def get_build_result_log( return cls(pipeline_response, deserialized, {}) return deserialized + get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore - - - @distributed_trace def get_resource_upload_url( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ResourceUploadDefinition" """Get an resource upload URL for build service, which may be artifacts or source archive. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1209,26 +668,29 @@ def get_resource_upload_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_resource_upload_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1241,18 +703,16 @@ def get_resource_upload_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace def list_supported_buildpacks( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpacksCollection": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SupportedBuildpacksCollection" """Get all supported buildpacks. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1272,26 +732,29 @@ def list_supported_buildpacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_supported_buildpacks.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_supported_buildpacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_buildpacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1304,19 +767,17 @@ def list_supported_buildpacks( return cls(pipeline_response, deserialized, {}) return deserialized + list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore - - - @distributed_trace def get_supported_buildpack( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpackResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + buildpack_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SupportedBuildpackResource" """Get the supported buildpack resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1338,27 +799,30 @@ def get_supported_buildpack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_supported_buildpack.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'buildpackName': self._serialize.url("buildpack_name", buildpack_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_supported_buildpack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - api_version=api_version, - template_url=self.get_supported_buildpack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1371,18 +835,16 @@ def get_supported_buildpack( return cls(pipeline_response, deserialized, {}) return deserialized + get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore - - - @distributed_trace def list_supported_stacks( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedStacksCollection": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SupportedStacksCollection" """Get all supported stacks. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1402,26 +864,29 @@ def list_supported_stacks( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_supported_stacks.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_supported_stacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_stacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1434,19 +899,17 @@ def list_supported_stacks( return cls(pipeline_response, deserialized, {}) return deserialized + list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore - - - @distributed_trace def get_supported_stack( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any - ) -> "_models.SupportedStackResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + stack_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SupportedStackResource" """Get the supported stack resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1468,27 +931,30 @@ def get_supported_stack( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_supported_stack.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'stackName': self._serialize.url("stack_name", stack_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_supported_stack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - api_version=api_version, - template_url=self.get_supported_stack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1501,6 +967,4 @@ def get_supported_stack( return cls(pipeline_response, deserialized, {}) return deserialized - - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore - + get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py index 64c9943c8b9..d9facbd8c7d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_buildpack_binding_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,201 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class BuildpackBindingOperations(object): """BuildpackBindingOperations operations. @@ -224,16 +47,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> "_models.BuildpackBindingResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + buildpack_binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BuildpackBindingResource" """Get a buildpack binding by name. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -257,28 +80,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,51 +117,54 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> "_models.BuildpackBindingResource": + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + buildpack_binding_name, # type: str + buildpack_binding, # type: "_models.BuildpackBindingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.BuildpackBindingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -352,21 +181,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> LROPoller["_models.BuildpackBindingResource"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + buildpack_binding_name, # type: str + buildpack_binding, # type: "_models.BuildpackBindingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.BuildpackBindingResource"] """Create or update a buildpack binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -381,24 +208,17 @@ def begin_create_or_update( :param buildpack_binding_name: The name of the Buildpack Binding Name. :type buildpack_binding_name: str :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource + :type buildpack_binding: ~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( @@ -414,22 +234,30 @@ def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,46 +267,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + buildpack_binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -488,19 +320,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + buildpack_binding_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Buildpack Binding. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -516,17 +347,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type buildpack_binding_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -541,18 +369,27 @@ def begin_delete( # pylint: disable=inconsistent-return-statements build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + 'buildpackBindingName': self._serialize.url("buildpack_binding_name", buildpack_binding_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -562,19 +399,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + build_service_name, # type: str + builder_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BuildpackBindingResourceCollection"] """Handles requests to list all buildpack bindings in a builder. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -587,52 +424,47 @@ def list( :param builder_name: The name of the builder resource. :type builder_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] + :return: An iterator like instance of either BuildpackBindingResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'buildServiceName': self._serialize.url("build_service_name", build_service_name, 'str'), + 'builderName': self._serialize.url("builder_name", builder_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) + deserialized = self._deserialize('BuildpackBindingResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -641,11 +473,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -654,8 +482,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py index f4548d0e160..8479ce22015 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,185 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CertificatesOperations(object): """CertificatesOperations operations. @@ -208,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" """Get the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -235,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CertificateResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_resource, 'CertificateResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -327,19 +172,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> LROPoller["_models.CertificateResource"]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + certificate_resource, # type: "_models.CertificateResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CertificateResource"] """Create or update certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -350,24 +193,17 @@ def begin_create_or_update( :param certificate_name: The name of the certificate resource. :type certificate_name: str :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource + :type certificate_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CertificateResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( @@ -381,22 +217,28 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CertificateResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -406,42 +248,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -451,17 +297,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the certificate resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -473,17 +318,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type certificate_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -496,18 +338,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -517,17 +366,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.CertificateResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CertificateResourceCollection"] """List all the certificates of one user. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -536,48 +385,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] + :return: An iterator like instance of either CertificateResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) + deserialized = self._deserialize('CertificateResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -586,11 +432,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -599,8 +441,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py index b96c2738185..ab72f2e1cef 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,194 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigServersOperations(object): """ConfigServersOperations operations. @@ -217,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" """Get the config server and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -241,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -272,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -327,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -347,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -377,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -402,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_resource, 'ConfigServerResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -457,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: + resource_group_name, # type: str + service_name, # type: str + config_server_resource, # type: "_models.ConfigServerResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerResource"] """Update the config server. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -477,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource + :type config_server_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( @@ -507,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -532,45 +364,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigServerSettingsValidateResult" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(config_server_settings, 'ConfigServerSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -587,18 +424,16 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace def begin_validate( self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: + resource_group_name, # type: str + service_name, # type: str + config_server_settings, # type: "_models.ConfigServerSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigServerSettingsValidateResult"] """Check if the config server settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -607,24 +442,17 @@ def begin_validate( :param service_name: The name of the Service resource. :type service_name: str :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings + :type config_server_settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigServerSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( @@ -637,22 +465,27 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -662,6 +495,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py index 7eb2e2b4b01..847de780d36 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_configuration_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,231 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ConfigurationServicesOperations(object): """ConfigurationServicesOperations operations. @@ -254,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": + resource_group_name, # type: str + service_name, # type: str + configuration_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationServiceResource" """Get the Application Configuration Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -281,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -313,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": + resource_group_name, # type: str + service_name, # type: str + configuration_service_name, # type: str + configuration_service_resource, # type: "_models.ConfigurationServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -370,19 +169,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigurationServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + configuration_service_name, # type: str + configuration_service_resource, # type: "_models.ConfigurationServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigurationServiceResource"] """Create the default Application Configuration Service or update the existing Application Configuration Service. @@ -394,24 +191,17 @@ def begin_create_or_update( :param configuration_service_name: The name of Application Configuration Service. :type configuration_service_name: str :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource + :type configuration_service_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( @@ -425,22 +215,28 @@ def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -450,42 +246,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + configuration_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -495,17 +295,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + configuration_service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Disable the default Application Configuration Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -517,17 +316,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type configuration_service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -540,18 +336,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -561,17 +364,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ConfigurationServiceResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -580,48 +383,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] + :return: An iterator like instance of either ConfigurationServiceResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) + deserialized = self._deserialize('ConfigurationServiceResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -630,11 +430,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -643,49 +439,53 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore def _validate_initial( self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> "_models.ConfigurationServiceSettingsValidateResult": + resource_group_name, # type: str + service_name, # type: str + configuration_service_name, # type: str + settings, # type: "_models.ConfigurationServiceSettings" + **kwargs # type: Any + ): + # type: (...) -> "_models.ConfigurationServiceSettingsValidateResult" cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(settings, 'ConfigurationServiceSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._validate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(settings, 'ConfigurationServiceSettings') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -702,19 +502,17 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore - - - @distributed_trace def begin_validate( self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"]: + resource_group_name, # type: str + service_name, # type: str + configuration_service_name, # type: str + settings, # type: "_models.ConfigurationServiceSettings" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"] """Check if the Application Configuration Service settings are valid. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -728,20 +526,14 @@ def begin_validate( :type settings: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettings :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ConfigurationServiceSettingsValidateResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ConfigurationServiceSettingsValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( @@ -755,22 +547,28 @@ def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'configurationServiceName': self._serialize.url("configuration_service_name", configuration_service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -780,6 +578,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py index 9949e31c50a..3308e48649a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,241 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class CustomDomainsOperations(object): """CustomDomainsOperations operations. @@ -264,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" """Get the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -294,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -327,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -389,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Create or update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -418,20 +205,14 @@ def begin_create_or_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -446,22 +227,29 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -471,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -543,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -567,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -588,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(domain_resource, 'CustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -647,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + domain_name, # type: str + domain_resource, # type: "_models.CustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.CustomDomainResource"] """Update custom domain of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -676,20 +475,14 @@ def begin_update( :type domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either CustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( @@ -704,22 +497,29 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('CustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,18 +529,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.CustomDomainResourceCollection"] """List the custom domains of one lifecycle application. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -751,50 +551,46 @@ def list( :param app_name: The name of the App resource. :type app_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] + :return: An iterator like instance of either CustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('CustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -803,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -816,8 +608,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py index 8a71e1e1f7f..f70ebea5539 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,591 +5,27 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_cluster_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restart_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_log_file_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_generate_heap_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_generate_thread_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_start_jfr_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class DeploymentsOperations(object): # pylint: disable=too-many-public-methods + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DeploymentsOperations(object): """DeploymentsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -612,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" """Get a Deployment and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -642,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -675,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -737,20 +178,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Create a new Deployment or update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -763,24 +202,17 @@ def begin_create_or_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -795,22 +227,29 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -820,44 +259,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -867,18 +310,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -892,17 +334,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -916,18 +355,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -937,49 +384,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.DeploymentResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(deployment_resource, 'DeploymentResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -996,20 +448,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + deployment_resource, # type: "_models.DeploymentResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DeploymentResource"] """Operation to update an exiting Deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1022,24 +472,17 @@ def begin_update( :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource + :type deployment_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DeploymentResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( @@ -1054,22 +497,29 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('DeploymentResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1079,19 +529,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """Handles requests to list all resources in an App. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1101,55 +551,51 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1158,11 +604,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1171,20 +613,19 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore - @distributed_trace def list_for_cluster( self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + version=None, # type: Optional[List[str]] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeploymentResourceCollection"] """List deployments for a certain service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1192,53 +633,50 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] + :return: An iterator like instance of either DeploymentResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_for_cluster.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if version is not None: + query_parameters['version'] = [self._serialize.query("version", q, 'str') if q is not None else '' for q in version] + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) + deserialized = self._deserialize('DeploymentResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1247,11 +685,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1260,46 +694,49 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1309,18 +746,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1334,17 +770,14 @@ def begin_start( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1358,18 +791,26 @@ def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1379,44 +820,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1426,18 +871,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1451,17 +895,14 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1475,18 +916,26 @@ def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1496,44 +945,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1543,18 +996,17 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - - @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements + def begin_restart( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Restart the deployment. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1568,17 +1020,14 @@ def begin_restart( # pylint: disable=inconsistent-return-statements :type deployment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1592,18 +1041,26 @@ def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1613,19 +1070,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - @distributed_trace def get_log_file_url( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogFileUrlResponse"] """Get deployment log file URL. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1647,27 +1104,30 @@ def get_log_file_url( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_log_file_url.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1682,49 +1142,52 @@ def get_log_file_url( return cls(pipeline_response, deserialized, {}) return deserialized + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + def _generate_heap_dump_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_heap_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1734,19 +1197,18 @@ def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - @distributed_trace - def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + def begin_generate_heap_dump( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Generate Heap Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1759,22 +1221,17 @@ def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1789,19 +1246,26 @@ def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1811,49 +1275,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + def _generate_thread_dump_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._generate_thread_dump_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1863,19 +1332,18 @@ def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - - @distributed_trace - def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + def begin_generate_thread_dump( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Generate Thread Dump. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1888,22 +1356,17 @@ def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statement :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1918,19 +1381,26 @@ def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statement app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1940,49 +1410,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + def _start_jfr_initial( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._start_jfr_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1992,19 +1467,18 @@ def _start_jfr_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore - - @distributed_trace - def begin_start_jfr( # pylint: disable=inconsistent-return-statements + def begin_start_jfr( self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + app_name, # type: str + deployment_name, # type: str + diagnostic_parameters, # type: "_models.DiagnosticParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start JFR. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -2017,22 +1491,17 @@ def begin_start_jfr( # pylint: disable=inconsistent-return-statements :param deployment_name: The name of the Deployment resource. :type deployment_name: str :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters + :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.DiagnosticParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -2047,19 +1516,26 @@ def begin_start_jfr( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'appName': self._serialize.url("app_name", app_name, 'str'), + 'deploymentName': self._serialize.url("deployment_name", deployment_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -2069,6 +1545,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py index 32a152a04a5..1cfaff6e8f7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,193 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class GatewayCustomDomainsOperations(object): """GatewayCustomDomainsOperations operations. @@ -216,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.GatewayCustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GatewayCustomDomainResource" """Get the Spring Cloud Gateway custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -246,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -279,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", - **kwargs: Any - ) -> "_models.GatewayCustomDomainResource": + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + domain_name, # type: str + gateway_custom_domain_resource, # type: "_models.GatewayCustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.GatewayCustomDomainResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -338,20 +175,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.GatewayCustomDomainResource"]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + domain_name, # type: str + gateway_custom_domain_resource, # type: "_models.GatewayCustomDomainResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GatewayCustomDomainResource"] """Create or update the Spring Cloud Gateway custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -365,24 +200,17 @@ def begin_create_or_update( :type domain_name: str :param gateway_custom_domain_resource: The gateway custom domain resource for the create or update operation. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource + :type gateway_custom_domain_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( @@ -397,22 +225,29 @@ def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -422,44 +257,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -469,18 +308,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + domain_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the Spring Cloud Gateway custom domain. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -494,17 +332,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type domain_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -518,18 +353,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'domainName': self._serialize.url("domain_name", domain_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -539,18 +382,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GatewayCustomDomainResourceCollection"] """Handle requests to list all Spring Cloud Gateway custom domains. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -561,50 +404,46 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] + :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) + deserialized = self._deserialize('GatewayCustomDomainResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -613,11 +452,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -626,8 +461,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py index ea36d09af01..bc96fbc6552 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateway_route_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,193 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class GatewayRouteConfigsOperations(object): """GatewayRouteConfigsOperations operations. @@ -216,15 +47,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> "_models.GatewayRouteConfigResource": + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + route_config_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GatewayRouteConfigResource" """Get the Spring Cloud Gateway route configs. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -246,27 +77,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -279,49 +113,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: "_models.GatewayRouteConfigResource", - **kwargs: Any - ) -> "_models.GatewayRouteConfigResource": + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + route_config_name, # type: str + gateway_route_config_resource, # type: "_models.GatewayRouteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.GatewayRouteConfigResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -338,20 +175,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: "_models.GatewayRouteConfigResource", - **kwargs: Any - ) -> LROPoller["_models.GatewayRouteConfigResource"]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + route_config_name, # type: str + gateway_route_config_resource, # type: "_models.GatewayRouteConfigResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GatewayRouteConfigResource"] """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud Gateway route configs. @@ -366,24 +201,17 @@ def begin_create_or_update( :type route_config_name: str :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or update operation. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource + :type gateway_route_config_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( @@ -398,22 +226,29 @@ def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -423,44 +258,48 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + route_config_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -470,18 +309,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + route_config_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the Spring Cloud Gateway route config. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -495,17 +333,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type route_config_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -519,18 +354,26 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + 'routeConfigName': self._serialize.url("route_config_name", route_config_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -540,18 +383,18 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GatewayRouteConfigResourceCollection"] """Handle requests to list all Spring Cloud Gateway route configs. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -562,50 +405,46 @@ def list( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] + :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) + deserialized = self._deserialize('GatewayRouteConfigResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -614,11 +453,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -627,8 +462,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py index 0598ab10638..194061d1061 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_gateways_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,231 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class GatewaysOperations(object): """GatewaysOperations operations. @@ -254,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> "_models.GatewayResource": + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.GatewayResource" """Get the Spring Cloud Gateway and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -281,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -313,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: "_models.GatewayResource", - **kwargs: Any - ) -> "_models.GatewayResource": + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + gateway_resource, # type: "_models.GatewayResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.GatewayResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_resource, 'GatewayResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(gateway_resource, 'GatewayResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -370,19 +169,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: "_models.GatewayResource", - **kwargs: Any - ) -> LROPoller["_models.GatewayResource"]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + gateway_resource, # type: "_models.GatewayResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.GatewayResource"] """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -396,20 +193,14 @@ def begin_create_or_update( :type gateway_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either GatewayResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( @@ -423,22 +214,28 @@ def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('GatewayResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -448,42 +245,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -493,17 +294,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Disable the default Spring Cloud Gateway. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -515,17 +315,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type gateway_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -538,18 +335,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -559,17 +363,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.GatewayResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GatewayResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -578,48 +382,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] + :return: An iterator like instance of either GatewayResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) + deserialized = self._deserialize('GatewayResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -628,11 +429,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -641,21 +438,20 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore - @distributed_trace def validate_domain( self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": + resource_group_name, # type: str + service_name, # type: str + gateway_name, # type: str + validate_payload, # type: "_models.CustomDomainValidatePayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.CustomDomainValidateResult" """Check the domains are valid as well as not in use. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -666,8 +462,7 @@ def validate_domain( :param gateway_name: The name of Spring Cloud Gateway. :type gateway_name: str :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload + :type validate_payload: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidatePayload :keyword callable cls: A custom type or function that will be passed the direct response :return: CustomDomainValidateResult, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.CustomDomainValidateResult @@ -678,30 +473,34 @@ def validate_domain( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.validate_domain.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -714,6 +513,4 @@ def validate_domain( return cls(pipeline_response, deserialized, {}) return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore - + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py index 77549aec608..e6ff2086618 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,150 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class MonitoringSettingsOperations(object): """MonitoringSettingsOperations operations. @@ -173,13 +46,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" """Get the Monitoring Setting and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -197,25 +70,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,45 +104,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_put_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -283,18 +162,16 @@ def _update_put_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_put( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -303,24 +180,17 @@ def begin_update_put( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -333,22 +203,27 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -358,45 +233,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.MonitoringSettingResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_patch_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -413,18 +293,16 @@ def _update_patch_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace def begin_update_patch( self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: + resource_group_name, # type: str + service_name, # type: str + monitoring_setting_resource, # type: "_models.MonitoringSettingResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MonitoringSettingResource"] """Update the Monitoring Setting. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -433,24 +311,17 @@ def begin_update_patch( :param service_name: The name of the Service resource. :type service_name: str :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource + :type monitoring_setting_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MonitoringSettingResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.MonitoringSettingResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( @@ -463,22 +334,27 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -488,6 +364,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py index b2d1f7e9bf4..9056b4dc128 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,50 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. @@ -73,49 +45,47 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailableOperations"] """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) + deserialized = self._deserialize('AvailableOperations', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -124,11 +94,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,8 +103,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py index b658b519029..70077593f37 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,49 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_runtime_versions_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class RuntimeVersionsOperations(object): """RuntimeVersionsOperations operations. @@ -72,11 +44,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list_runtime_versions( self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailableRuntimeVersions" """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -89,22 +61,22 @@ def list_runtime_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_runtime_versions.metadata['url'] # type: ignore - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -117,6 +89,4 @@ def list_runtime_versions( return cls(pipeline_response, deserialized, {}) return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py index 3d6c06c0bb9..7bd9b2ab829 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_service_registries_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,176 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServiceRegistriesOperations(object): """ServiceRegistriesOperations operations. @@ -199,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": + resource_group_name, # type: str + service_name, # type: str + service_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceRegistryResource" """Get the Service Registry and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -226,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -258,42 +109,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": + resource_group_name, # type: str + service_name, # type: str + service_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceRegistryResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.put(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -310,18 +163,16 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> LROPoller["_models.ServiceRegistryResource"]: + resource_group_name, # type: str + service_name, # type: str + service_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceRegistryResource"] """Create the default Service Registry or update the existing Service Registry. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -333,19 +184,14 @@ def begin_create_or_update( :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( @@ -358,21 +204,28 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -382,42 +235,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + service_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -427,17 +284,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + service_registry_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Disable the default Service Registry. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -449,17 +305,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type service_registry_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -472,18 +325,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'serviceRegistryName': self._serialize.url("service_registry_name", service_registry_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -493,17 +353,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceRegistryResourceCollection"] """Handles requests to list all resources in a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -512,48 +372,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] + :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) + deserialized = self._deserialize('ServiceRegistryResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -562,11 +419,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -575,8 +428,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py index 774c6ec8e3e..f85033954bd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,519 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_test_keys_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_test_key_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_disable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_enable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations(object): """ServicesOperations operations. @@ -542,13 +47,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" """Get a Service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -566,25 +71,28 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -597,45 +105,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -655,18 +166,16 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Create a new Service or update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -678,20 +187,14 @@ def begin_create_or_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -704,22 +207,27 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,40 +237,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -772,16 +284,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Operation to delete a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -791,17 +302,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -813,18 +321,24 @@ def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -834,45 +348,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(resource, 'ServiceResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -889,18 +408,16 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace def begin_update( self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: + resource_group_name, # type: str + service_name, # type: str + resource, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ServiceResource"] """Operation to update an exiting Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -912,20 +429,14 @@ def begin_update( :type resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -938,22 +449,27 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -963,17 +479,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace def list_test_keys( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """List test keys for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -991,25 +507,28 @@ def list_test_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_test_keys.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1022,18 +541,16 @@ def list_test_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace def regenerate_test_key( self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + regenerate_test_key_request, # type: "_models.RegenerateTestKeyRequestPayload" + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Regenerate a test key for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1042,8 +559,7 @@ def regenerate_test_key( :param service_name: The name of the Service resource. :type service_name: str :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload + :type regenerate_test_key_request: ~azure.mgmt.appplatform.v2022_01_01_preview.models.RegenerateTestKeyRequestPayload :keyword callable cls: A custom type or function that will be passed the direct response :return: TestKeys, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.TestKeys @@ -1054,29 +570,33 @@ def regenerate_test_key( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.regenerate_test_key.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1089,17 +609,15 @@ def regenerate_test_key( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + def disable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Disable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1117,25 +635,28 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.disable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1145,16 +666,15 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore - - @distributed_trace def enable_test_endpoint( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.TestKeys" """Enable test endpoint functionality for a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1172,25 +692,28 @@ def enable_test_endpoint( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.enable_test_endpoint.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1203,40 +726,42 @@ def enable_test_endpoint( return cls(pipeline_response, deserialized, {}) return deserialized + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1246,16 +771,15 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Stop a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1265,17 +789,14 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1287,18 +808,24 @@ def begin_stop( # pylint: disable=inconsistent-return-statements raw_result = self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1308,40 +835,44 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1351,16 +882,15 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Start a Service. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1370,17 +900,14 @@ def begin_start( # pylint: disable=inconsistent-return-statements :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -1392,18 +919,24 @@ def begin_start( # pylint: disable=inconsistent-return-statements raw_result = self._start_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1413,24 +946,23 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore - @distributed_trace def check_name_availability( self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": + location, # type: str + availability_parameters, # type: "_models.NameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NameAvailability" """Checks that the resource name is valid and is not already in use. :param location: the region. :type location: str :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters + :type availability_parameters: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NameAvailability, or the result of cls(response) :rtype: ~azure.mgmt.appplatform.v2022_01_01_preview.models.NameAvailability @@ -1441,28 +973,32 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'location': self._serialize.url("location", location, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1475,55 +1011,53 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace def list_by_subscription( self, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1532,11 +1066,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1545,18 +1075,17 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] """Handles requests to list all resources in a resource group. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -1564,44 +1093,43 @@ def list( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) + deserialized = self._deserialize('ServiceResourceList', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1610,11 +1138,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1623,8 +1147,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py index eb209b9ed5d..924797dd16c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,56 +5,23 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class SkusOperations(object): """SkusOperations operations. @@ -79,52 +45,51 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def list( self, - **kwargs: Any - ) -> Iterable["_models.ResourceSkuCollection"]: + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceSkuCollection"] """Lists all of the available skus of the Microsoft.AppPlatform provider. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] + :return: An iterator like instance of either ResourceSkuCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) + deserialized = self._deserialize('ResourceSkuCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -133,11 +98,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -146,8 +107,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py index 8c38ca3d71a..df22cb48b2c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/operations/_storages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,185 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +from typing import TYPE_CHECKING +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class StoragesOperations(object): """StoragesOperations operations. @@ -208,14 +47,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - @distributed_trace def get( self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> "_models.StorageResource": + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.StorageResource" """Get the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -235,26 +74,29 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -267,47 +109,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> "_models.StorageResource": + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + storage_resource, # type: "_models.StorageResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.StorageResource" cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(storage_resource, 'StorageResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + api_version = "2022-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(storage_resource, 'StorageResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -327,19 +172,17 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace def begin_create_or_update( self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> LROPoller["_models.StorageResource"]: + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + storage_resource, # type: "_models.StorageResource" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.StorageResource"] """Create or update storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -353,20 +196,14 @@ def begin_create_or_update( :type storage_resource: ~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] - :raises: ~azure.core.exceptions.HttpResponseError + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either StorageResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResource] + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( @@ -380,22 +217,28 @@ def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, - api_version=api_version, - content_type=content_type, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('StorageResource', pipeline_response) + if cls: return cls(pipeline_response, deserialized, {}) return deserialized + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -405,42 +248,46 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> None: + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -450,17 +297,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> LROPoller[None]: + resource_group_name, # type: str + service_name, # type: str + storage_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Delete the storage resource. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -472,17 +318,14 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :type storage_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError + :raises ~azure.core.exceptions.HttpResponseError: """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -495,18 +338,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + 'storageName': self._serialize.url("storage_name", storage_name, 'str'), + } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -516,17 +366,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - @distributed_trace def list( self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.StorageResourceCollection"]: + resource_group_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StorageResourceCollection"] """List all the storages of one Azure Spring Cloud instance. :param resource_group_name: The name of the resource group that contains the resource. You can @@ -535,48 +385,45 @@ def list( :param service_name: The name of the Service resource. :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] + :return: An iterator like instance of either StorageResourceCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_01_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-01-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = "2022-01-01-preview" + accept = "application/json" + def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request def extract_data(pipeline_response): - deserialized = self._deserialize("StorageResourceCollection", pipeline_response) + deserialized = self._deserialize('StorageResourceCollection', pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -585,11 +432,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -598,8 +441,7 @@ def get_next(next_link=None): return pipeline_response - return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py index a02c226fdda..f0b76b080b1 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_app_platform_management_client.py @@ -7,12 +7,11 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any, Optional, TYPE_CHECKING from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer from . import models from ._configuration import AppPlatformManagementClientConfiguration @@ -22,7 +21,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClient: """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -92,11 +91,8 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is 'https://management.azure.com'. :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -142,7 +138,7 @@ def __init__( def _send_request( self, - request: HttpRequest, + request, # type: HttpRequest **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py index 20a46c65a9f..e5024e5cd94 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,12 +27,8 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -42,8 +38,6 @@ def __init__( **kwargs: Any ) -> None: super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -51,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2022-03-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py index 41d1acdf305..2b76234971e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_app_platform_management_client.py @@ -7,12 +7,11 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from msrest import Deserializer, Serializer +from typing import Any, Awaitable, Optional, TYPE_CHECKING from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer from .. import models from ._configuration import AppPlatformManagementClientConfiguration @@ -22,7 +21,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClient: """REST API for Azure Spring Cloud. :ivar services: ServicesOperations operations @@ -92,11 +91,8 @@ class AppPlatformManagementClient: # pylint: disable=too-many-instance-attrib :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is 'https://management.azure.com'. :type base_url: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py index f4327c3935c..619930321b8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class AppPlatformManagementClientConfiguration(Configuration): """Configuration for AppPlatformManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,12 +27,8 @@ class AppPlatformManagementClientConfiguration(Configuration): # pylint: disabl :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-03-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str """ def __init__( @@ -42,8 +38,6 @@ def __init__( **kwargs: Any ) -> None: super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -51,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = api_version + self.api_version = "2022-03-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py index eb85bf5b49b..5a32bc04731 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portal_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -78,8 +79,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,17 +86,12 @@ async def get( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( @@ -129,7 +123,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') @@ -140,7 +133,6 @@ async def _create_or_update_initial( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -148,11 +140,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -170,7 +158,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore @distributed_trace_async @@ -212,9 +200,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -228,7 +215,6 @@ async def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -253,11 +239,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,8 +258,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -280,17 +265,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -300,11 +280,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -335,8 +315,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,7 +328,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -370,9 +348,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore @distributed_trace def list( @@ -398,8 +377,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -413,7 +390,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -426,7 +402,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -444,11 +419,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -461,4 +432,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py index 81191a45a5e..2400cab84c4 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_api_portals_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,25 +76,18 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore async def _create_or_update_initial( @@ -124,7 +118,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') @@ -134,7 +127,6 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -142,11 +134,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -164,7 +152,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore @distributed_trace_async @@ -201,9 +189,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,7 +203,6 @@ async def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -241,11 +227,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -258,25 +245,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -286,11 +266,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -318,8 +298,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -331,7 +310,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -352,9 +330,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore @distributed_trace def list( @@ -377,8 +356,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -391,7 +368,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -403,7 +379,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -421,11 +396,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,7 +409,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore @distributed_trace_async async def validate_domain( @@ -472,7 +443,6 @@ async def validate_domain( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -482,7 +452,6 @@ async def validate_domain( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -490,11 +459,7 @@ async def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -508,5 +473,5 @@ async def validate_domain( return deserialized - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py index 3e3b322b94c..c25856e85e1 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -65,7 +66,7 @@ async def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -78,26 +79,19 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, sync_status=sync_status, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _create_or_update_initial( @@ -128,7 +122,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -138,7 +131,6 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -146,11 +138,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -171,7 +159,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace_async @@ -208,9 +196,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -223,7 +210,6 @@ async def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -248,11 +234,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -265,25 +252,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -293,11 +273,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -325,8 +305,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -338,7 +317,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -359,9 +337,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore async def _update_initial( self, @@ -377,7 +356,6 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -387,7 +365,6 @@ async def _update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -395,11 +372,7 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -417,7 +390,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace_async @@ -454,9 +427,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -469,7 +441,6 @@ async def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -494,9 +465,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace def list( @@ -519,8 +491,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -533,7 +503,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -545,7 +514,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -563,11 +531,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -580,7 +544,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore @distributed_trace_async async def get_resource_upload_url( @@ -610,25 +574,18 @@ async def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -642,7 +599,7 @@ async def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore async def _set_active_deployments_initial( @@ -659,7 +616,6 @@ async def _set_active_deployments_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') @@ -669,7 +625,6 @@ async def _set_active_deployments_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._set_active_deployments_initial.metadata['url'], @@ -677,11 +632,7 @@ async def _set_active_deployments_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -699,7 +650,7 @@ async def _set_active_deployments_initial( return deserialized - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore @distributed_trace_async @@ -737,9 +688,8 @@ async def begin_set_active_deployments( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -752,7 +702,6 @@ async def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -777,9 +726,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore @distributed_trace_async async def validate_domain( @@ -813,7 +763,6 @@ async def validate_domain( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -823,7 +772,6 @@ async def validate_domain( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -831,11 +779,7 @@ async def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -849,5 +793,5 @@ async def validate_domain( return deserialized - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py index 7989a7b680e..18bc40f856f 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -78,8 +79,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,17 +86,12 @@ async def get( service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _create_or_update_initial( @@ -129,7 +123,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -140,7 +133,6 @@ async def _create_or_update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -148,11 +140,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -173,7 +161,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace_async @@ -213,9 +201,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -229,7 +216,6 @@ async def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -254,11 +240,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -272,8 +259,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -281,17 +266,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +281,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -336,8 +316,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -350,7 +329,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -371,9 +349,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore async def _update_initial( self, @@ -390,7 +369,6 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -401,7 +379,6 @@ async def _update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -409,11 +386,7 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -431,7 +404,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace_async @@ -471,9 +444,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -487,7 +459,6 @@ async def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -512,9 +483,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace def list( @@ -540,8 +512,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -555,7 +525,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -568,7 +537,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -586,11 +554,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -603,4 +567,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py index bdfca21c53e..26fea28b511 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_agent_pool_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -71,8 +72,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -86,7 +85,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -99,7 +97,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -117,11 +114,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -134,7 +127,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore @distributed_trace_async async def get( @@ -167,8 +160,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -176,17 +167,12 @@ async def get( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -200,7 +186,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore async def _update_put_initial( @@ -218,7 +204,6 @@ async def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') @@ -229,7 +214,6 @@ async def _update_put_initial( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -237,11 +221,7 @@ async def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -259,7 +239,7 @@ async def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore @distributed_trace_async @@ -300,9 +280,8 @@ async def begin_update_put( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -316,7 +295,6 @@ async def begin_update_put( build_service_name=build_service_name, agent_pool_name=agent_pool_name, agent_pool_resource=agent_pool_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -341,6 +319,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py index 4a86ced05dc..5126e4fa954 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_builder_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -78,8 +79,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,17 +86,12 @@ async def get( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore async def _create_or_update_initial( @@ -129,7 +123,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(builder_resource, 'BuilderResource') @@ -140,7 +133,6 @@ async def _create_or_update_initial( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -148,11 +140,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -170,7 +158,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore @distributed_trace_async @@ -210,9 +198,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -226,7 +213,6 @@ async def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -251,11 +237,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -269,8 +256,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -278,17 +263,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -298,11 +278,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -333,8 +313,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -347,7 +326,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -368,9 +346,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore @distributed_trace def list( @@ -396,8 +375,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -411,7 +388,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -424,7 +400,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -442,11 +417,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -459,4 +430,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py index 60f92c37f7e..4218cb50e41 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_build_service_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -66,8 +67,6 @@ def list_build_services( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -80,7 +79,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list_build_services.metadata['url'], ) request = _convert_request(request) @@ -92,7 +90,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -110,11 +107,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,7 +120,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore @distributed_trace_async async def get_build_service( @@ -157,25 +150,18 @@ async def get_build_service( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_service_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.get_build_service.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -189,7 +175,7 @@ async def get_build_service( return deserialized - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore @distributed_trace @@ -215,8 +201,6 @@ def list_builds( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -230,7 +214,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list_builds.metadata['url'], ) request = _convert_request(request) @@ -243,7 +226,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -261,11 +243,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -278,7 +256,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore @distributed_trace_async async def get_build( @@ -311,8 +289,6 @@ async def get_build( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_request( subscription_id=self._config.subscription_id, @@ -320,17 +296,12 @@ async def get_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, template_url=self.get_build.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,7 +315,7 @@ async def get_build( return deserialized - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore @distributed_trace_async @@ -381,7 +352,6 @@ async def create_or_update_build( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(build, 'Build') @@ -392,7 +362,6 @@ async def create_or_update_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update_build.metadata['url'], @@ -400,11 +369,7 @@ async def create_or_update_build( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -422,7 +387,7 @@ async def create_or_update_build( return deserialized - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore @distributed_trace @@ -452,8 +417,6 @@ def list_build_results( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -468,7 +431,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, template_url=self.list_build_results.metadata['url'], ) request = _convert_request(request) @@ -482,7 +444,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -500,11 +461,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -517,7 +474,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore @distributed_trace_async async def get_build_result( @@ -553,8 +510,6 @@ async def get_build_result( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_result_request( subscription_id=self._config.subscription_id, @@ -563,17 +518,12 @@ async def get_build_result( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, - api_version=api_version, template_url=self.get_build_result.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -587,7 +537,7 @@ async def get_build_result( return deserialized - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore @distributed_trace_async @@ -624,8 +574,6 @@ async def get_build_result_log( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_result_log_request( subscription_id=self._config.subscription_id, @@ -634,17 +582,12 @@ async def get_build_result_log( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, - api_version=api_version, template_url=self.get_build_result_log.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -658,7 +601,7 @@ async def get_build_result_log( return deserialized - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore @distributed_trace_async @@ -689,25 +632,18 @@ async def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -721,7 +657,7 @@ async def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore @distributed_trace_async @@ -752,25 +688,18 @@ async def list_supported_buildpacks( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_supported_buildpacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list_supported_buildpacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -784,7 +713,7 @@ async def list_supported_buildpacks( return deserialized - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore @distributed_trace_async @@ -818,8 +747,6 @@ async def get_supported_buildpack( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_supported_buildpack_request( subscription_id=self._config.subscription_id, @@ -827,17 +754,12 @@ async def get_supported_buildpack( service_name=service_name, build_service_name=build_service_name, buildpack_name=buildpack_name, - api_version=api_version, template_url=self.get_supported_buildpack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -851,7 +773,7 @@ async def get_supported_buildpack( return deserialized - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore @distributed_trace_async @@ -882,25 +804,18 @@ async def list_supported_stacks( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_supported_stacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list_supported_stacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -914,7 +829,7 @@ async def list_supported_stacks( return deserialized - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore @distributed_trace_async @@ -948,8 +863,6 @@ async def get_supported_stack( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_supported_stack_request( subscription_id=self._config.subscription_id, @@ -957,17 +870,12 @@ async def get_supported_stack( service_name=service_name, build_service_name=build_service_name, stack_name=stack_name, - api_version=api_version, template_url=self.get_supported_stack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -981,5 +889,5 @@ async def get_supported_stack( return deserialized - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py index aa6c16502f5..d503ed5a502 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_buildpack_binding_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -81,8 +82,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -91,17 +90,12 @@ async def get( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,7 +109,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore async def _create_or_update_initial( @@ -134,7 +128,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') @@ -146,7 +139,6 @@ async def _create_or_update_initial( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -154,11 +146,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -176,7 +164,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore @distributed_trace_async @@ -220,9 +208,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -237,7 +224,6 @@ async def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -262,11 +248,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -281,8 +268,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -291,17 +276,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -311,11 +291,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -349,8 +329,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -364,7 +343,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -385,9 +363,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore @distributed_trace def list( @@ -416,8 +395,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -432,7 +409,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -446,7 +422,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -464,11 +439,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -481,4 +452,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py index 2f9c98801df..55fcada116d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,25 +76,18 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore async def _create_or_update_initial( @@ -124,7 +118,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(certificate_resource, 'CertificateResource') @@ -134,7 +127,6 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -142,11 +134,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -167,7 +155,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore @distributed_trace_async @@ -205,9 +193,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,7 +207,6 @@ async def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -245,11 +231,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -262,25 +249,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -290,11 +270,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -322,8 +302,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -335,7 +314,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -356,9 +334,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore @distributed_trace def list( @@ -381,8 +360,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -395,7 +372,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -407,7 +383,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -425,11 +400,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -442,4 +413,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py index eb86aa5b680..eba0608f3e9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -70,24 +71,17 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +95,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_put_initial( @@ -117,7 +111,6 @@ async def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -126,7 +119,6 @@ async def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -134,11 +126,7 @@ async def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,7 +144,7 @@ async def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore @distributed_trace_async @@ -191,9 +179,8 @@ async def begin_update_put( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -205,7 +192,6 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -230,9 +216,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _update_patch_initial( self, @@ -247,7 +234,6 @@ async def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -256,7 +242,6 @@ async def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -264,11 +249,7 @@ async def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -286,7 +267,7 @@ async def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore @distributed_trace_async @@ -321,9 +302,8 @@ async def begin_update_patch( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,7 +315,6 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -360,9 +339,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore async def _validate_initial( self, @@ -377,7 +357,6 @@ async def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') @@ -386,7 +365,6 @@ async def _validate_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -394,11 +372,7 @@ async def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -416,7 +390,7 @@ async def _validate_initial( return deserialized - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore @distributed_trace_async @@ -451,9 +425,8 @@ async def begin_validate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -465,7 +438,6 @@ async def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -490,6 +462,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py index 1a7089b8ab8..c5b83d3c1e0 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_configuration_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,25 +76,18 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore async def _create_or_update_initial( @@ -124,7 +118,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') @@ -134,7 +127,6 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -142,11 +134,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -164,7 +152,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore @distributed_trace_async @@ -203,9 +191,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -218,7 +205,6 @@ async def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -243,11 +229,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -260,25 +247,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -288,11 +268,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -320,8 +300,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -333,7 +312,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -354,9 +332,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore @distributed_trace def list( @@ -379,8 +358,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -393,7 +370,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -405,7 +381,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -423,11 +398,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -440,7 +411,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore async def _validate_initial( self, @@ -456,7 +427,6 @@ async def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(settings, 'ConfigurationServiceSettings') @@ -466,7 +436,6 @@ async def _validate_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -474,11 +443,7 @@ async def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -496,7 +461,7 @@ async def _validate_initial( return deserialized - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore @distributed_trace_async @@ -533,9 +498,8 @@ async def begin_validate( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -548,7 +512,6 @@ async def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -573,6 +536,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py index 16ef55ae2d7..a3535c5c5fd 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -78,8 +79,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,17 +86,12 @@ async def get( service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( @@ -129,7 +123,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -140,7 +133,6 @@ async def _create_or_update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -148,11 +140,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -173,7 +161,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace_async @@ -213,9 +201,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -229,7 +216,6 @@ async def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -254,11 +240,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -272,8 +259,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -281,17 +266,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +281,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -336,8 +316,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -350,7 +329,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -371,9 +349,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore async def _update_initial( self, @@ -390,7 +369,6 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -401,7 +379,6 @@ async def _update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -409,11 +386,7 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -431,7 +404,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace_async @@ -471,9 +444,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -487,7 +459,6 @@ async def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -512,9 +483,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace def list( @@ -540,8 +512,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -555,7 +525,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -568,7 +537,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -586,11 +554,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -603,4 +567,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py index 0aa9463a082..52dcd963b3a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -25,7 +26,7 @@ T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class DeploymentsOperations: # pylint: disable=too-many-public-methods +class DeploymentsOperations: """DeploymentsOperations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -78,8 +79,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,17 +86,12 @@ async def get( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _create_or_update_initial( @@ -129,7 +123,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -140,7 +133,6 @@ async def _create_or_update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -148,11 +140,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -173,7 +161,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace_async @@ -214,9 +202,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -230,7 +217,6 @@ async def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -255,11 +241,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -273,8 +260,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -282,17 +267,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -302,11 +282,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -337,8 +317,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -351,7 +330,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -372,9 +350,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore async def _update_initial( self, @@ -391,7 +370,6 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -402,7 +380,6 @@ async def _update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -410,11 +387,7 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -432,7 +405,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace_async @@ -473,9 +446,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -489,7 +461,6 @@ async def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -514,9 +485,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace def list( @@ -536,7 +508,7 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -545,8 +517,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -560,7 +530,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, version=version, template_url=self.list.metadata['url'], ) @@ -574,7 +543,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, version=version, template_url=next_link, ) @@ -593,11 +561,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -610,7 +574,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore @distributed_trace def list_for_cluster( @@ -627,7 +591,7 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -636,8 +600,6 @@ def list_for_cluster( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -650,7 +612,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, version=version, template_url=self.list_for_cluster.metadata['url'], ) @@ -663,7 +624,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, version=version, template_url=next_link, ) @@ -682,11 +642,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -699,9 +655,9 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -715,8 +671,6 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_start_request_initial( subscription_id=self._config.subscription_id, @@ -724,17 +678,12 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -744,11 +693,11 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -779,8 +728,7 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -793,7 +741,6 @@ async def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -814,11 +761,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -832,8 +780,6 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_stop_request_initial( subscription_id=self._config.subscription_id, @@ -841,17 +787,12 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -861,11 +802,11 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -896,8 +837,7 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -910,7 +850,6 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -931,11 +870,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, service_name: str, @@ -949,8 +889,6 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_restart_request_initial( subscription_id=self._config.subscription_id, @@ -958,17 +896,12 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -978,11 +911,11 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements + async def begin_restart( self, resource_group_name: str, service_name: str, @@ -1013,8 +946,7 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1027,7 +959,6 @@ async def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1048,9 +979,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore @distributed_trace_async async def get_log_file_url( @@ -1083,8 +1015,6 @@ async def get_log_file_url( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_log_file_url_request( subscription_id=self._config.subscription_id, @@ -1092,17 +1022,12 @@ async def get_log_file_url( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self.get_log_file_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1118,10 +1043,10 @@ async def get_log_file_url( return deserialized - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + async def _generate_heap_dump_initial( self, resource_group_name: str, service_name: str, @@ -1136,7 +1061,6 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1147,7 +1071,6 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_heap_dump_initial.metadata['url'], @@ -1155,11 +1078,7 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1169,11 +1088,11 @@ async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-st if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore @distributed_trace_async - async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + async def begin_generate_heap_dump( self, resource_group_name: str, service_name: str, @@ -1208,9 +1127,8 @@ async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-state :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1224,7 +1142,6 @@ async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-state app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1246,11 +1163,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + async def _generate_thread_dump_initial( self, resource_group_name: str, service_name: str, @@ -1265,7 +1183,6 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1276,7 +1193,6 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_thread_dump_initial.metadata['url'], @@ -1284,11 +1200,7 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1298,11 +1210,11 @@ async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore @distributed_trace_async - async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + async def begin_generate_thread_dump( self, resource_group_name: str, service_name: str, @@ -1337,9 +1249,8 @@ async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-sta :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1353,7 +1264,6 @@ async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-sta app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1375,11 +1285,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + async def _start_jfr_initial( self, resource_group_name: str, service_name: str, @@ -1394,7 +1305,6 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1405,7 +1315,6 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._start_jfr_initial.metadata['url'], @@ -1413,11 +1322,7 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1427,11 +1332,11 @@ async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore @distributed_trace_async - async def begin_start_jfr( # pylint: disable=inconsistent-return-statements + async def begin_start_jfr( self, resource_group_name: str, service_name: str, @@ -1466,9 +1371,8 @@ async def begin_start_jfr( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1482,7 +1386,6 @@ async def begin_start_jfr( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1504,6 +1407,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py index f995109bebe..5bd88c74a45 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -78,8 +79,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,17 +86,12 @@ async def get( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore async def _create_or_update_initial( @@ -129,7 +123,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') @@ -140,7 +133,6 @@ async def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -148,11 +140,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -170,7 +158,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore @distributed_trace_async @@ -212,9 +200,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -228,7 +215,6 @@ async def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -253,11 +239,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -271,8 +258,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -280,17 +265,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -300,11 +280,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -335,8 +315,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -349,7 +328,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -370,9 +348,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore @distributed_trace def list( @@ -398,8 +377,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -413,7 +390,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -426,7 +402,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -444,11 +419,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -461,4 +432,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py index e7a4938113f..460f7dc4328 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateway_route_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -78,8 +79,6 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -87,17 +86,12 @@ async def get( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +105,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore async def _create_or_update_initial( @@ -129,7 +123,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') @@ -140,7 +133,6 @@ async def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -148,11 +140,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -170,7 +158,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore @distributed_trace_async @@ -213,9 +201,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -229,7 +216,6 @@ async def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -254,11 +240,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -272,8 +259,6 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -281,17 +266,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -301,11 +281,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -336,8 +316,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -350,7 +329,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -371,9 +349,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore @distributed_trace def list( @@ -399,8 +378,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -414,7 +391,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -427,7 +403,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -445,11 +420,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -462,4 +433,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py index 4e5d0927d6a..444722d3331 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_gateways_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,25 +76,18 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore async def _create_or_update_initial( @@ -124,7 +118,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_resource, 'GatewayResource') @@ -134,7 +127,6 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -142,11 +134,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -164,7 +152,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore @distributed_trace_async @@ -201,9 +189,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,7 +203,6 @@ async def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -241,11 +227,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -258,25 +245,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -286,11 +266,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -318,8 +298,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -331,7 +310,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -352,9 +330,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore @distributed_trace def list( @@ -377,8 +356,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -391,7 +368,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -403,7 +379,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -421,11 +396,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -438,7 +409,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore @distributed_trace_async async def validate_domain( @@ -472,7 +443,6 @@ async def validate_domain( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -482,7 +452,6 @@ async def validate_domain( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -490,11 +459,7 @@ async def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -508,5 +473,5 @@ async def validate_domain( return deserialized - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py index 300216417b0..76c99d5d286 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -70,24 +71,17 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +95,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_put_initial( @@ -117,7 +111,6 @@ async def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -126,7 +119,6 @@ async def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -134,11 +126,7 @@ async def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -156,7 +144,7 @@ async def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore @distributed_trace_async @@ -191,9 +179,8 @@ async def begin_update_put( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -205,7 +192,6 @@ async def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -230,9 +216,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore async def _update_patch_initial( self, @@ -247,7 +234,6 @@ async def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -256,7 +242,6 @@ async def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -264,11 +249,7 @@ async def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -286,7 +267,7 @@ async def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore @distributed_trace_async @@ -321,9 +302,8 @@ async def begin_update_patch( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -335,7 +315,6 @@ async def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -360,6 +339,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py index 361418cd51e..82cb8a1a31d 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -14,6 +15,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -57,8 +59,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -68,7 +68,6 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,7 +76,6 @@ def prepare_request(next_link=None): else: request = build_list_request( - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -95,11 +93,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -112,4 +106,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py index de591e0bc63..b6d3f4140df 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -61,21 +62,14 @@ async def list_runtime_versions( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_runtime_versions_request( - api_version=api_version, template_url=self.list_runtime_versions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -89,5 +83,5 @@ async def list_runtime_versions( return deserialized - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py index 8280787fcd0..19cd77b04ac 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_service_registries_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,25 +76,18 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore async def _create_or_update_initial( @@ -123,25 +117,18 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, template_url=self._create_or_update_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -159,7 +146,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore @distributed_trace_async @@ -193,8 +180,7 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -206,7 +192,6 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -230,11 +215,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -247,25 +233,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -275,11 +254,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -307,8 +286,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -320,7 +298,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -341,9 +318,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore @distributed_trace def list( @@ -366,8 +344,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -380,7 +356,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -392,7 +367,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -410,11 +384,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -427,4 +397,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py index 33d5db18689..7a35a54127a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -72,24 +73,17 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +97,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _create_or_update_initial( @@ -119,7 +113,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -128,7 +121,6 @@ async def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -136,11 +128,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -161,7 +149,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace_async @@ -195,9 +183,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,7 +196,6 @@ async def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -234,11 +220,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -250,24 +237,17 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -277,11 +257,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -306,8 +286,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -318,7 +297,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = await self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -339,9 +317,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore async def _update_initial( self, @@ -356,7 +335,6 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -365,7 +343,6 @@ async def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -373,11 +350,7 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -395,7 +368,7 @@ async def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace_async @@ -429,9 +402,8 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -443,7 +415,6 @@ async def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -468,9 +439,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace_async async def list_test_keys( @@ -497,24 +469,17 @@ async def list_test_keys( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_test_keys_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list_test_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -528,7 +493,7 @@ async def list_test_keys( return deserialized - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore @distributed_trace_async @@ -560,7 +525,6 @@ async def regenerate_test_key( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') @@ -569,7 +533,6 @@ async def regenerate_test_key( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_test_key.metadata['url'], @@ -577,11 +540,7 @@ async def regenerate_test_key( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -595,11 +554,11 @@ async def regenerate_test_key( return deserialized - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + async def disable_test_endpoint( self, resource_group_name: str, service_name: str, @@ -623,24 +582,17 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_disable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.disable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -650,7 +602,7 @@ async def disable_test_endpoint( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore @distributed_trace_async @@ -678,24 +630,17 @@ async def enable_test_endpoint( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_enable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.enable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -709,10 +654,10 @@ async def enable_test_endpoint( return deserialized - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, service_name: str, @@ -724,24 +669,17 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_stop_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -751,11 +689,11 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements + async def begin_stop( self, resource_group_name: str, service_name: str, @@ -780,8 +718,7 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -792,7 +729,6 @@ async def begin_stop( # pylint: disable=inconsistent-return-statements raw_result = await self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -813,11 +749,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements + async def _start_initial( self, resource_group_name: str, service_name: str, @@ -829,24 +766,17 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_start_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -856,11 +786,11 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements + async def begin_start( self, resource_group_name: str, service_name: str, @@ -885,8 +815,7 @@ async def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -897,7 +826,6 @@ async def begin_start( # pylint: disable=inconsistent-return-statements raw_result = await self._start_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -918,9 +846,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore @distributed_trace_async async def check_name_availability( @@ -947,7 +876,6 @@ async def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') @@ -955,7 +883,6 @@ async def check_name_availability( request = build_check_name_availability_request( subscription_id=self._config.subscription_id, location=location, - api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -963,11 +890,7 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -981,7 +904,7 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore @distributed_trace @@ -997,8 +920,6 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1009,7 +930,6 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -1019,7 +939,6 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1037,11 +956,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1054,7 +969,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore @distributed_trace def list( @@ -1073,8 +988,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1086,7 +999,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -1097,7 +1009,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1115,11 +1026,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1132,4 +1039,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py index e9236ff4f7c..8357feb9b98 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -14,6 +15,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -58,8 +60,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -70,7 +70,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -80,7 +79,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -98,11 +96,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,4 +109,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py index b9f288e180a..03184f78f55 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/operations/_storages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -75,25 +76,18 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,7 +101,7 @@ async def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore async def _create_or_update_initial( @@ -124,7 +118,6 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(storage_resource, 'StorageResource') @@ -134,7 +127,6 @@ async def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -142,11 +134,7 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -167,7 +155,7 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore @distributed_trace_async @@ -204,9 +192,8 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,7 +206,6 @@ async def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -244,11 +230,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, service_name: str, @@ -261,25 +248,18 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -289,11 +269,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements + async def begin_delete( self, resource_group_name: str, service_name: str, @@ -321,8 +301,7 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -334,7 +313,6 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -355,9 +333,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore @distributed_trace def list( @@ -380,8 +359,6 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -394,7 +371,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -406,7 +382,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -424,11 +399,7 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -441,4 +412,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py index b80473e23b3..08452944979 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/__init__.py @@ -201,12 +201,10 @@ ResourceSkuRestrictionsType, ServiceRegistryProvisioningState, SkuScaleType, - StorageType, SupportedRuntimePlatform, SupportedRuntimeValue, TestKeyType, TrafficDirection, - Type, ) __all__ = [ @@ -402,10 +400,8 @@ 'ResourceSkuRestrictionsType', 'ServiceRegistryProvisioningState', 'SkuScaleType', - 'StorageType', 'SupportedRuntimePlatform', 'SupportedRuntimeValue', 'TestKeyType', 'TrafficDirection', - 'Type', ] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py index b10f39b3966..ba15077e4fc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_app_platform_management_client_enums.py @@ -245,12 +245,6 @@ class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "Manual" AUTOMATIC = "Automatic" -class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the storage. - """ - - STORAGE_ACCOUNT = "StorageAccount" - class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The platform of this runtime version (possible values: "Java" or ".NET"). """ @@ -280,9 +274,3 @@ class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): INBOUND = "Inbound" OUTBOUND = "Outbound" - -class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the underlying resource to mount as a persistent disk. - """ - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py index 94ce69f1339..354a8f5f823 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/models/_models_py3.py @@ -310,8 +310,8 @@ class ApiPortalProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = False, - https_only: Optional[bool] = False, + public: Optional[bool] = None, + https_only: Optional[bool] = None, gateway_ids: Optional[List[str]] = None, source_urls: Optional[List[str]] = None, sso_properties: Optional["SsoProperties"] = None, @@ -756,8 +756,8 @@ class CustomPersistentDiskProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.Type + disk.Constant filled by server. + :vartype type: str :ivar mount_path: Required. The mount path of the persistent disk. :vartype mount_path: str :ivar read_only: Indicates whether the persistent disk is a readOnly one. @@ -811,8 +811,8 @@ class AzureFileVolume(CustomPersistentDiskProperties): All required parameters must be populated in order to send to Azure. :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.Type + disk.Constant filled by server. + :vartype type: str :ivar mount_path: Required. The mount path of the persistent disk. :vartype mount_path: str :ivar read_only: Indicates whether the persistent disk is a readOnly one. @@ -4323,8 +4323,8 @@ class GatewayProperties(msrest.serialization.Model): def __init__( self, *, - public: Optional[bool] = False, - https_only: Optional[bool] = False, + public: Optional[bool] = None, + https_only: Optional[bool] = None, sso_properties: Optional["SsoProperties"] = None, api_metadata_properties: Optional["GatewayApiMetadataProperties"] = None, cors_properties: Optional["GatewayCorsProperties"] = None, @@ -6870,9 +6870,8 @@ class StorageProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageType + :ivar storage_type: Required. The type of the storage.Constant filled by server. + :vartype storage_type: str """ _validation = { @@ -6902,9 +6901,8 @@ class StorageAccount(StorageProperties): All required parameters must be populated in order to send to Azure. - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageType + :ivar storage_type: Required. The type of the storage.Constant filled by server. + :vartype storage_type: str :ivar account_name: Required. The account name of the Azure Storage Account. :vartype account_name: str :ivar account_key: Required. The account key of the Azure Storage Account. diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py index 83ed21ad8d2..e98ddbbd5d2 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portal_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,11 +37,10 @@ def build_get_request( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,21 +49,21 @@ def build_get_request( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -80,12 +79,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -125,11 +124,10 @@ def build_delete_request_initial( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -138,21 +136,21 @@ def build_delete_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -164,11 +162,10 @@ def build_list_request( api_portal_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -176,21 +173,21 @@ def build_list_request( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -247,8 +244,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -256,17 +251,12 @@ def get( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,7 +270,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( @@ -298,7 +288,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') @@ -309,7 +298,6 @@ def _create_or_update_initial( service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -317,11 +305,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,7 +323,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore @distributed_trace @@ -381,9 +365,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -397,7 +380,6 @@ def begin_create_or_update( api_portal_name=api_portal_name, domain_name=domain_name, api_portal_custom_domain_resource=api_portal_custom_domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -422,11 +404,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -440,8 +423,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -449,17 +430,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -469,11 +445,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -504,8 +480,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -518,7 +493,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, api_portal_name=api_portal_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -539,9 +513,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}'} # type: ignore @distributed_trace def list( @@ -567,8 +542,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,7 +555,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -595,7 +567,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -613,11 +584,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -630,4 +597,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py index 978468a0daf..2336184687b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_api_portals_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,11 +36,10 @@ def build_get_request( api_portal_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -48,21 +47,21 @@ def build_get_request( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -77,12 +76,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -90,23 +89,23 @@ def build_create_or_update_request_initial( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -120,11 +119,10 @@ def build_delete_request_initial( api_portal_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -132,21 +130,21 @@ def build_delete_request_initial( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -157,32 +155,31 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -197,12 +194,12 @@ def build_validate_domain_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -210,23 +207,23 @@ def build_validate_domain_request( "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -282,25 +279,18 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -314,7 +304,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore def _create_or_update_initial( @@ -331,7 +321,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') @@ -341,7 +330,6 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -349,11 +337,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -371,7 +355,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore @distributed_trace @@ -408,9 +392,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -423,7 +406,6 @@ def begin_create_or_update( service_name=service_name, api_portal_name=api_portal_name, api_portal_resource=api_portal_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -448,11 +430,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -465,25 +448,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -493,11 +469,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -525,8 +501,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -538,7 +513,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -559,9 +533,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}'} # type: ignore @distributed_trace def list( @@ -584,8 +559,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ApiPortalResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -598,7 +571,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -610,7 +582,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -628,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -645,7 +612,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals'} # type: ignore @distributed_trace def validate_domain( @@ -679,7 +646,6 @@ def validate_domain( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -689,7 +655,6 @@ def validate_domain( resource_group_name=resource_group_name, service_name=service_name, api_portal_name=api_portal_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -697,11 +662,7 @@ def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -715,5 +676,5 @@ def validate_domain( return deserialized - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py index 6b71e487a5f..15a784cf08c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_apps_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,11 +38,10 @@ def build_get_request( sync_status: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,23 +49,23 @@ def build_get_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') + query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -81,12 +80,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -124,11 +123,10 @@ def build_delete_request_initial( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -136,21 +134,21 @@ def build_delete_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -165,12 +163,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -178,23 +176,23 @@ def build_update_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -207,32 +205,31 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -244,11 +241,10 @@ def build_get_resource_upload_url_request( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -256,21 +252,21 @@ def build_get_resource_upload_url_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -285,12 +281,12 @@ def build_set_active_deployments_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -298,23 +294,23 @@ def build_set_active_deployments_request_initial( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -331,12 +327,12 @@ def build_validate_domain_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -344,23 +340,23 @@ def build_validate_domain_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -406,7 +402,7 @@ def get( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. + :param sync_status: Indicates whether sync status. :type sync_status: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AppResource, or the result of cls(response) @@ -419,26 +415,19 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, sync_status=sync_status, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -452,7 +441,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _create_or_update_initial( @@ -469,7 +458,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -479,7 +467,6 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -487,11 +474,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -512,7 +495,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace @@ -549,9 +532,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -564,7 +546,6 @@ def begin_create_or_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -589,11 +570,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -606,25 +588,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -634,11 +609,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -666,8 +641,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -679,7 +653,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -700,9 +673,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore def _update_initial( self, @@ -718,7 +692,6 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(app_resource, 'AppResource') @@ -728,7 +701,6 @@ def _update_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -736,11 +708,7 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -758,7 +726,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace @@ -795,9 +763,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -810,7 +777,6 @@ def begin_update( service_name=service_name, app_name=app_name, app_resource=app_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -835,9 +801,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}'} # type: ignore @distributed_trace def list( @@ -860,8 +827,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -874,7 +839,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -886,7 +850,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -904,11 +867,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -921,7 +880,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps'} # type: ignore @distributed_trace def get_resource_upload_url( @@ -951,25 +910,18 @@ def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -983,7 +935,7 @@ def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl'} # type: ignore def _set_active_deployments_initial( @@ -1000,7 +952,6 @@ def _set_active_deployments_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') @@ -1010,7 +961,6 @@ def _set_active_deployments_initial( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._set_active_deployments_initial.metadata['url'], @@ -1018,11 +968,7 @@ def _set_active_deployments_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1040,7 +986,7 @@ def _set_active_deployments_initial( return deserialized - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + _set_active_deployments_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore @distributed_trace @@ -1078,9 +1024,8 @@ def begin_set_active_deployments( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.AppResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -1093,7 +1038,6 @@ def begin_set_active_deployments( service_name=service_name, app_name=app_name, active_deployment_collection=active_deployment_collection, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1118,9 +1062,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore + begin_set_active_deployments.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments'} # type: ignore @distributed_trace def validate_domain( @@ -1154,7 +1099,6 @@ def validate_domain( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -1164,7 +1108,6 @@ def validate_domain( resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -1172,11 +1115,7 @@ def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1190,5 +1129,5 @@ def validate_domain( return deserialized - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py index 4e59ea12b28..6b8ad8ac251 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_bindings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,11 +37,10 @@ def build_get_request( binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,21 +49,21 @@ def build_get_request( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -80,12 +79,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -125,11 +124,10 @@ def build_delete_request_initial( binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -138,21 +136,21 @@ def build_delete_request_initial( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -168,12 +166,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -182,23 +180,23 @@ def build_update_request_initial( "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -212,11 +210,10 @@ def build_list_request( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -224,21 +221,21 @@ def build_list_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -295,8 +292,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -304,17 +299,12 @@ def get( service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,7 +318,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _create_or_update_initial( @@ -346,7 +336,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -357,7 +346,6 @@ def _create_or_update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -365,11 +353,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -390,7 +374,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace @@ -430,9 +414,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -446,7 +429,6 @@ def begin_create_or_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -471,11 +453,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -489,8 +472,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -498,17 +479,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,11 +494,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -553,8 +529,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -567,7 +542,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -588,9 +562,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore def _update_initial( self, @@ -607,7 +582,6 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(binding_resource, 'BindingResource') @@ -618,7 +592,6 @@ def _update_initial( service_name=service_name, app_name=app_name, binding_name=binding_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -626,11 +599,7 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -648,7 +617,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace @@ -688,9 +657,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -704,7 +672,6 @@ def begin_update( app_name=app_name, binding_name=binding_name, binding_resource=binding_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -729,9 +696,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}'} # type: ignore @distributed_trace def list( @@ -757,8 +725,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -772,7 +738,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -785,7 +750,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -803,11 +767,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -820,4 +780,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py index 15a896ee5e4..548f2759609 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_agent_pool_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,11 +36,10 @@ def build_list_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -48,21 +47,21 @@ def build_list_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -75,11 +74,10 @@ def build_get_request( agent_pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -88,21 +86,21 @@ def build_get_request( "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -118,12 +116,12 @@ def build_update_put_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -132,23 +130,23 @@ def build_update_put_request_initial( "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -200,8 +198,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -215,7 +211,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -228,7 +223,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -246,11 +240,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -263,7 +253,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools'} # type: ignore @distributed_trace def get( @@ -296,8 +286,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -305,17 +293,12 @@ def get( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -329,7 +312,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore def _update_put_initial( @@ -347,7 +330,6 @@ def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') @@ -358,7 +340,6 @@ def _update_put_initial( service_name=service_name, build_service_name=build_service_name, agent_pool_name=agent_pool_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -366,11 +347,7 @@ def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -388,7 +365,7 @@ def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore @distributed_trace @@ -429,9 +406,8 @@ def begin_update_put( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceAgentPoolResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -445,7 +421,6 @@ def begin_update_put( build_service_name=build_service_name, agent_pool_name=agent_pool_name, agent_pool_resource=agent_pool_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -470,6 +445,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py index 352dd8f8129..f02385c6022 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_builder_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,11 +37,10 @@ def build_get_request( builder_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,21 +49,21 @@ def build_get_request( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -80,12 +79,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -125,11 +124,10 @@ def build_delete_request_initial( builder_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -138,21 +136,21 @@ def build_delete_request_initial( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -164,11 +162,10 @@ def build_list_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -176,21 +173,21 @@ def build_list_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -247,8 +244,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -256,17 +251,12 @@ def get( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,7 +270,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore def _create_or_update_initial( @@ -298,7 +288,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(builder_resource, 'BuilderResource') @@ -309,7 +298,6 @@ def _create_or_update_initial( service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -317,11 +305,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,7 +323,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore @distributed_trace @@ -379,9 +363,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -395,7 +378,6 @@ def begin_create_or_update( build_service_name=build_service_name, builder_name=builder_name, builder_resource=builder_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -420,11 +402,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -438,8 +421,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -447,17 +428,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -467,11 +443,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -502,8 +478,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -516,7 +491,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -537,9 +511,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}'} # type: ignore @distributed_trace def list( @@ -565,8 +540,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuilderResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -580,7 +553,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -593,7 +565,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -611,11 +582,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -628,4 +595,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py index 4629634f8c1..a642efb1678 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_build_service_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,32 +33,31 @@ def build_list_build_services_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -70,11 +69,10 @@ def build_get_build_service_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -82,21 +80,21 @@ def build_get_build_service_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -108,11 +106,10 @@ def build_list_builds_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -120,21 +117,21 @@ def build_list_builds_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -147,11 +144,10 @@ def build_get_build_request( build_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -160,21 +156,21 @@ def build_get_build_request( "buildName": _SERIALIZER.url("build_name", build_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -190,12 +186,12 @@ def build_create_or_update_build_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -204,23 +200,23 @@ def build_create_or_update_build_request( "buildName": _SERIALIZER.url("build_name", build_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -235,11 +231,10 @@ def build_list_build_results_request( build_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -248,21 +243,21 @@ def build_list_build_results_request( "buildName": _SERIALIZER.url("build_name", build_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -276,11 +271,10 @@ def build_get_build_result_request( build_result_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -290,21 +284,21 @@ def build_get_build_result_request( "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -318,11 +312,10 @@ def build_get_build_result_log_request( build_result_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -332,21 +325,21 @@ def build_get_build_result_log_request( "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -358,11 +351,10 @@ def build_get_resource_upload_url_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -370,21 +362,21 @@ def build_get_resource_upload_url_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -396,11 +388,10 @@ def build_list_supported_buildpacks_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -408,21 +399,21 @@ def build_list_supported_buildpacks_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -435,11 +426,10 @@ def build_get_supported_buildpack_request( buildpack_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -448,21 +438,21 @@ def build_get_supported_buildpack_request( "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -474,11 +464,10 @@ def build_list_supported_stacks_request( build_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -486,21 +475,21 @@ def build_list_supported_stacks_request( "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -513,11 +502,10 @@ def build_get_supported_stack_request( stack_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -526,21 +514,21 @@ def build_get_supported_stack_request( "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -587,8 +575,6 @@ def list_build_services( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildServiceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -601,7 +587,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list_build_services.metadata['url'], ) request = _convert_request(request) @@ -613,7 +598,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -631,11 +615,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -648,7 +628,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore + list_build_services.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices'} # type: ignore @distributed_trace def get_build_service( @@ -678,25 +658,18 @@ def get_build_service( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_service_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.get_build_service.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -710,7 +683,7 @@ def get_build_service( return deserialized - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore + get_build_service.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}'} # type: ignore @distributed_trace @@ -736,8 +709,6 @@ def list_builds( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -751,7 +722,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list_builds.metadata['url'], ) request = _convert_request(request) @@ -764,7 +734,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -782,11 +751,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -799,7 +764,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore + list_builds.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds'} # type: ignore @distributed_trace def get_build( @@ -832,8 +797,6 @@ def get_build( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_request( subscription_id=self._config.subscription_id, @@ -841,17 +804,12 @@ def get_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, template_url=self.get_build.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -865,7 +823,7 @@ def get_build( return deserialized - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + get_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore @distributed_trace @@ -902,7 +860,6 @@ def create_or_update_build( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(build, 'Build') @@ -913,7 +870,6 @@ def create_or_update_build( service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update_build.metadata['url'], @@ -921,11 +877,7 @@ def create_or_update_build( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -943,7 +895,7 @@ def create_or_update_build( return deserialized - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore + create_or_update_build.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}'} # type: ignore @distributed_trace @@ -973,8 +925,6 @@ def list_build_results( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildResultCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -989,7 +939,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, template_url=self.list_build_results.metadata['url'], ) request = _convert_request(request) @@ -1003,7 +952,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, build_name=build_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1021,11 +969,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1038,7 +982,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore + list_build_results.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results'} # type: ignore @distributed_trace def get_build_result( @@ -1074,8 +1018,6 @@ def get_build_result( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_result_request( subscription_id=self._config.subscription_id, @@ -1084,17 +1026,12 @@ def get_build_result( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, - api_version=api_version, template_url=self.get_build_result.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1108,7 +1045,7 @@ def get_build_result( return deserialized - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore + get_build_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}'} # type: ignore @distributed_trace @@ -1145,8 +1082,6 @@ def get_build_result_log( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_build_result_log_request( subscription_id=self._config.subscription_id, @@ -1155,17 +1090,12 @@ def get_build_result_log( build_service_name=build_service_name, build_name=build_name, build_result_name=build_result_name, - api_version=api_version, template_url=self.get_build_result_log.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1179,7 +1109,7 @@ def get_build_result_log( return deserialized - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore + get_build_result_log.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl'} # type: ignore @distributed_trace @@ -1210,25 +1140,18 @@ def get_resource_upload_url( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_resource_upload_url_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.get_resource_upload_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1242,7 +1165,7 @@ def get_resource_upload_url( return deserialized - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore + get_resource_upload_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl'} # type: ignore @distributed_trace @@ -1273,25 +1196,18 @@ def list_supported_buildpacks( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_supported_buildpacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list_supported_buildpacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1305,7 +1221,7 @@ def list_supported_buildpacks( return deserialized - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore + list_supported_buildpacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks'} # type: ignore @distributed_trace @@ -1339,8 +1255,6 @@ def get_supported_buildpack( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_supported_buildpack_request( subscription_id=self._config.subscription_id, @@ -1348,17 +1262,12 @@ def get_supported_buildpack( service_name=service_name, build_service_name=build_service_name, buildpack_name=buildpack_name, - api_version=api_version, template_url=self.get_supported_buildpack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1372,7 +1281,7 @@ def get_supported_buildpack( return deserialized - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore + get_supported_buildpack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}'} # type: ignore @distributed_trace @@ -1403,25 +1312,18 @@ def list_supported_stacks( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_supported_stacks_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, build_service_name=build_service_name, - api_version=api_version, template_url=self.list_supported_stacks.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1435,7 +1337,7 @@ def list_supported_stacks( return deserialized - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore + list_supported_stacks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks'} # type: ignore @distributed_trace @@ -1469,8 +1371,6 @@ def get_supported_stack( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_supported_stack_request( subscription_id=self._config.subscription_id, @@ -1478,17 +1378,12 @@ def get_supported_stack( service_name=service_name, build_service_name=build_service_name, stack_name=stack_name, - api_version=api_version, template_url=self.get_supported_stack.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1502,5 +1397,5 @@ def get_supported_stack( return deserialized - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore + get_supported_stack.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py index 8df841baf9b..068152705e9 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_buildpack_binding_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,11 +38,10 @@ def build_get_request( buildpack_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -52,21 +51,21 @@ def build_get_request( "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -83,12 +82,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -98,23 +97,23 @@ def build_create_or_update_request_initial( "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -130,11 +129,10 @@ def build_delete_request_initial( buildpack_binding_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -144,21 +142,21 @@ def build_delete_request_initial( "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -171,11 +169,10 @@ def build_list_request( builder_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -184,21 +181,21 @@ def build_list_request( "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -258,8 +255,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -268,17 +263,12 @@ def get( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -292,7 +282,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore def _create_or_update_initial( @@ -311,7 +301,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') @@ -323,7 +312,6 @@ def _create_or_update_initial( build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -331,11 +319,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -353,7 +337,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore @distributed_trace @@ -397,9 +381,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -414,7 +397,6 @@ def begin_create_or_update( builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, buildpack_binding=buildpack_binding, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -439,11 +421,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -458,8 +441,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -468,17 +449,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -488,11 +464,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -526,8 +502,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -541,7 +516,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements build_service_name=build_service_name, builder_name=builder_name, buildpack_binding_name=buildpack_binding_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -562,9 +536,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}'} # type: ignore @distributed_trace def list( @@ -593,8 +568,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.BuildpackBindingResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -609,7 +582,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -623,7 +595,6 @@ def prepare_request(next_link=None): service_name=service_name, build_service_name=build_service_name, builder_name=builder_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -641,11 +612,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -658,4 +625,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py index 9a6735a7505..7d35d013c1b 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_certificates_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,11 +36,10 @@ def build_get_request( certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -48,21 +47,21 @@ def build_get_request( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -77,12 +76,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -90,23 +89,23 @@ def build_create_or_update_request_initial( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -120,11 +119,10 @@ def build_delete_request_initial( certificate_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -132,21 +130,21 @@ def build_delete_request_initial( "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -157,32 +155,31 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -236,25 +233,18 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,7 +258,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore def _create_or_update_initial( @@ -285,7 +275,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(certificate_resource, 'CertificateResource') @@ -295,7 +284,6 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -303,11 +291,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -328,7 +312,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore @distributed_trace @@ -366,9 +350,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -381,7 +364,6 @@ def begin_create_or_update( service_name=service_name, certificate_name=certificate_name, certificate_resource=certificate_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -406,11 +388,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -423,25 +406,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -451,11 +427,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -483,8 +459,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -496,7 +471,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, certificate_name=certificate_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -517,9 +491,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}'} # type: ignore @distributed_trace def list( @@ -542,8 +517,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CertificateResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -556,7 +529,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -568,7 +540,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -586,11 +557,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -603,4 +570,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py index 75f20a2a7af..0619baa15e5 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_config_servers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,6 +17,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,32 +34,31 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -73,35 +72,35 @@ def build_update_put_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -117,35 +116,35 @@ def build_update_patch_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -161,35 +160,35 @@ def build_validate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -242,24 +241,17 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -273,7 +265,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_put_initial( @@ -289,7 +281,6 @@ def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -298,7 +289,6 @@ def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -306,11 +296,7 @@ def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -328,7 +314,7 @@ def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore @distributed_trace @@ -363,9 +349,8 @@ def begin_update_put( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -377,7 +362,6 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -402,9 +386,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _update_patch_initial( self, @@ -419,7 +404,6 @@ def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_resource, 'ConfigServerResource') @@ -428,7 +412,6 @@ def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -436,11 +419,7 @@ def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -458,7 +437,7 @@ def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore @distributed_trace @@ -493,9 +472,8 @@ def begin_update_patch( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -507,7 +485,6 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, config_server_resource=config_server_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -532,9 +509,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default'} # type: ignore def _validate_initial( self, @@ -549,7 +527,6 @@ def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') @@ -558,7 +535,6 @@ def _validate_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -566,11 +542,7 @@ def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -588,7 +560,7 @@ def _validate_initial( return deserialized - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore @distributed_trace @@ -623,9 +595,8 @@ def begin_validate( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigServerSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -637,7 +608,6 @@ def begin_validate( resource_group_name=resource_group_name, service_name=service_name, config_server_settings=config_server_settings, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -662,6 +632,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py index 07a5d39d525..d608556a3c7 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_configuration_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,11 +36,10 @@ def build_get_request( configuration_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -48,21 +47,21 @@ def build_get_request( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -77,12 +76,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -90,23 +89,23 @@ def build_create_or_update_request_initial( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -120,11 +119,10 @@ def build_delete_request_initial( configuration_service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -132,21 +130,21 @@ def build_delete_request_initial( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -157,32 +155,31 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -197,12 +194,12 @@ def build_validate_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -210,23 +207,23 @@ def build_validate_request_initial( "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -282,25 +279,18 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -314,7 +304,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore def _create_or_update_initial( @@ -331,7 +321,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') @@ -341,7 +330,6 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -349,11 +337,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -371,7 +355,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore @distributed_trace @@ -410,9 +394,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -425,7 +408,6 @@ def begin_create_or_update( service_name=service_name, configuration_service_name=configuration_service_name, configuration_service_resource=configuration_service_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -450,11 +432,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -467,25 +450,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -495,11 +471,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -527,8 +503,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -540,7 +515,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -561,9 +535,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}'} # type: ignore @distributed_trace def list( @@ -586,8 +561,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -600,7 +573,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -612,7 +584,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -630,11 +601,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -647,7 +614,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices'} # type: ignore def _validate_initial( self, @@ -663,7 +630,6 @@ def _validate_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(settings, 'ConfigurationServiceSettings') @@ -673,7 +639,6 @@ def _validate_initial( resource_group_name=resource_group_name, service_name=service_name, configuration_service_name=configuration_service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._validate_initial.metadata['url'], @@ -681,11 +646,7 @@ def _validate_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -703,7 +664,7 @@ def _validate_initial( return deserialized - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + _validate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore @distributed_trace @@ -740,9 +701,8 @@ def begin_validate( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ConfigurationServiceSettingsValidateResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -755,7 +715,6 @@ def begin_validate( service_name=service_name, configuration_service_name=configuration_service_name, settings=settings, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -780,6 +739,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore + begin_validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py index d3acd61a5e8..0ad2172363c 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,11 +37,10 @@ def build_get_request( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,21 +49,21 @@ def build_get_request( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -80,12 +79,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -125,11 +124,10 @@ def build_delete_request_initial( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -138,21 +136,21 @@ def build_delete_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -168,12 +166,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -182,23 +180,23 @@ def build_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -212,11 +210,10 @@ def build_list_request( app_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -224,21 +221,21 @@ def build_list_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -295,8 +292,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -304,17 +299,12 @@ def get( service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,7 +318,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( @@ -346,7 +336,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -357,7 +346,6 @@ def _create_or_update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -365,11 +353,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -390,7 +374,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace @@ -430,9 +414,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -446,7 +429,6 @@ def begin_create_or_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -471,11 +453,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -489,8 +472,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -498,17 +479,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -518,11 +494,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -553,8 +529,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -567,7 +542,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -588,9 +562,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore def _update_initial( self, @@ -607,7 +582,6 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(domain_resource, 'CustomDomainResource') @@ -618,7 +592,6 @@ def _update_initial( service_name=service_name, app_name=app_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -626,11 +599,7 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -648,7 +617,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace @@ -688,9 +657,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -704,7 +672,6 @@ def begin_update( app_name=app_name, domain_name=domain_name, domain_resource=domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -729,9 +696,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}'} # type: ignore @distributed_trace def list( @@ -757,8 +725,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.CustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -772,7 +738,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -785,7 +750,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -803,11 +767,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -820,4 +780,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py index 173c689fdf2..3a9803f2bd3 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,11 +37,10 @@ def build_get_request( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,21 +49,21 @@ def build_get_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -80,12 +79,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -125,11 +124,10 @@ def build_delete_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -138,21 +136,21 @@ def build_delete_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -168,12 +166,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -182,23 +180,23 @@ def build_update_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -214,11 +212,10 @@ def build_list_request( version: Optional[List[str]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -226,23 +223,23 @@ def build_list_request( "appName": _SERIALIZER.url("app_name", app_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -255,34 +252,33 @@ def build_list_for_cluster_request( version: Optional[List[str]] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] + query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -295,11 +291,10 @@ def build_start_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -308,21 +303,21 @@ def build_start_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -335,11 +330,10 @@ def build_stop_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -348,21 +342,21 @@ def build_stop_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -375,11 +369,10 @@ def build_restart_request_initial( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -388,21 +381,21 @@ def build_restart_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -415,11 +408,10 @@ def build_get_log_file_url_request( deployment_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -428,21 +420,21 @@ def build_get_log_file_url_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -458,12 +450,12 @@ def build_generate_heap_dump_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -472,23 +464,23 @@ def build_generate_heap_dump_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -506,12 +498,12 @@ def build_generate_thread_dump_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -520,23 +512,23 @@ def build_generate_thread_dump_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -554,12 +546,12 @@ def build_start_jfr_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -568,29 +560,29 @@ def build_start_jfr_request_initial( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs ) -class DeploymentsOperations(object): # pylint: disable=too-many-public-methods +class DeploymentsOperations(object): """DeploymentsOperations operations. You should not instantiate this class directly. Instead, you should create a Client instance that @@ -643,8 +635,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -652,17 +642,12 @@ def get( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -676,7 +661,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _create_or_update_initial( @@ -694,7 +679,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -705,7 +689,6 @@ def _create_or_update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -713,11 +696,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -738,7 +717,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace @@ -779,9 +758,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -795,7 +773,6 @@ def begin_create_or_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -820,11 +797,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -838,8 +816,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -847,17 +823,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -867,11 +838,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -902,8 +873,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -916,7 +886,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -937,9 +906,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore def _update_initial( self, @@ -956,7 +926,6 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(deployment_resource, 'DeploymentResource') @@ -967,7 +936,6 @@ def _update_initial( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -975,11 +943,7 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -997,7 +961,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace @@ -1038,9 +1002,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -1054,7 +1017,6 @@ def begin_update( app_name=app_name, deployment_name=deployment_name, deployment_resource=deployment_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1079,9 +1041,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}'} # type: ignore @distributed_trace def list( @@ -1101,7 +1064,7 @@ def list( :type service_name: str :param app_name: The name of the App resource. :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -1110,8 +1073,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1125,7 +1086,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, version=version, template_url=self.list.metadata['url'], ) @@ -1139,7 +1099,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, app_name=app_name, - api_version=api_version, version=version, template_url=next_link, ) @@ -1158,11 +1117,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1175,7 +1130,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments'} # type: ignore @distributed_trace def list_for_cluster( @@ -1192,7 +1147,7 @@ def list_for_cluster( :type resource_group_name: str :param service_name: The name of the Service resource. :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. + :param version: Version of the deployments to be listed. :type version: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DeploymentResourceCollection or the result of @@ -1201,8 +1156,6 @@ def list_for_cluster( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.DeploymentResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1215,7 +1168,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, version=version, template_url=self.list_for_cluster.metadata['url'], ) @@ -1228,7 +1180,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, version=version, template_url=next_link, ) @@ -1247,11 +1198,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1264,9 +1211,9 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore + list_for_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, resource_group_name: str, service_name: str, @@ -1280,8 +1227,6 @@ def _start_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_start_request_initial( subscription_id=self._config.subscription_id, @@ -1289,17 +1234,12 @@ def _start_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1309,11 +1249,11 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, resource_group_name: str, service_name: str, @@ -1344,8 +1284,7 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1358,7 +1297,6 @@ def begin_start( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1379,11 +1317,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start'} # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, resource_group_name: str, service_name: str, @@ -1397,8 +1336,6 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_stop_request_initial( subscription_id=self._config.subscription_id, @@ -1406,17 +1343,12 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1426,11 +1358,11 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, resource_group_name: str, service_name: str, @@ -1461,8 +1393,7 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1475,7 +1406,6 @@ def begin_stop( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1496,11 +1426,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop'} # type: ignore - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, resource_group_name: str, service_name: str, @@ -1514,8 +1445,6 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_restart_request_initial( subscription_id=self._config.subscription_id, @@ -1523,17 +1452,12 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self._restart_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1543,11 +1467,11 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements + def begin_restart( self, resource_group_name: str, service_name: str, @@ -1578,8 +1502,7 @@ def begin_restart( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1592,7 +1515,6 @@ def begin_restart( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1613,9 +1535,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart'} # type: ignore @distributed_trace def get_log_file_url( @@ -1648,8 +1571,6 @@ def get_log_file_url( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_log_file_url_request( subscription_id=self._config.subscription_id, @@ -1657,17 +1578,12 @@ def get_log_file_url( service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, template_url=self.get_log_file_url.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -1683,10 +1599,10 @@ def get_log_file_url( return deserialized - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore + get_log_file_url.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl'} # type: ignore - def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements + def _generate_heap_dump_initial( self, resource_group_name: str, service_name: str, @@ -1701,7 +1617,6 @@ def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statemen } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1712,7 +1627,6 @@ def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statemen service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_heap_dump_initial.metadata['url'], @@ -1720,11 +1634,7 @@ def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statemen request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1734,11 +1644,11 @@ def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statemen if cls: return cls(pipeline_response, None, {}) - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + _generate_heap_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore @distributed_trace - def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements + def begin_generate_heap_dump( self, resource_group_name: str, service_name: str, @@ -1773,9 +1683,8 @@ def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1789,7 +1698,6 @@ def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1811,11 +1719,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore + begin_generate_heap_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump'} # type: ignore - def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements + def _generate_thread_dump_initial( self, resource_group_name: str, service_name: str, @@ -1830,7 +1739,6 @@ def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statem } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1841,7 +1749,6 @@ def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statem service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._generate_thread_dump_initial.metadata['url'], @@ -1849,11 +1756,7 @@ def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statem request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1863,11 +1766,11 @@ def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, {}) - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + _generate_thread_dump_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore @distributed_trace - def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements + def begin_generate_thread_dump( self, resource_group_name: str, service_name: str, @@ -1902,9 +1805,8 @@ def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statement :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1918,7 +1820,6 @@ def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statement app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -1940,11 +1841,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore + begin_generate_thread_dump.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump'} # type: ignore - def _start_jfr_initial( # pylint: disable=inconsistent-return-statements + def _start_jfr_initial( self, resource_group_name: str, service_name: str, @@ -1959,7 +1861,6 @@ def _start_jfr_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') @@ -1970,7 +1871,6 @@ def _start_jfr_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, app_name=app_name, deployment_name=deployment_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._start_jfr_initial.metadata['url'], @@ -1978,11 +1878,7 @@ def _start_jfr_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -1992,11 +1888,11 @@ def _start_jfr_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + _start_jfr_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore @distributed_trace - def begin_start_jfr( # pylint: disable=inconsistent-return-statements + def begin_start_jfr( self, resource_group_name: str, service_name: str, @@ -2031,9 +1927,8 @@ def begin_start_jfr( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -2047,7 +1942,6 @@ def begin_start_jfr( # pylint: disable=inconsistent-return-statements app_name=app_name, deployment_name=deployment_name, diagnostic_parameters=diagnostic_parameters, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -2069,6 +1963,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore + begin_start_jfr.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py index 08db59d600a..1e774b99f10 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_custom_domains_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,11 +37,10 @@ def build_get_request( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,21 +49,21 @@ def build_get_request( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -80,12 +79,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -125,11 +124,10 @@ def build_delete_request_initial( domain_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -138,21 +136,21 @@ def build_delete_request_initial( "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -164,11 +162,10 @@ def build_list_request( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -176,21 +173,21 @@ def build_list_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -247,8 +244,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -256,17 +251,12 @@ def get( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,7 +270,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore def _create_or_update_initial( @@ -298,7 +288,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') @@ -309,7 +298,6 @@ def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -317,11 +305,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,7 +323,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore @distributed_trace @@ -381,9 +365,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -397,7 +380,6 @@ def begin_create_or_update( gateway_name=gateway_name, domain_name=domain_name, gateway_custom_domain_resource=gateway_custom_domain_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -422,11 +404,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -440,8 +423,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -449,17 +430,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -469,11 +445,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -504,8 +480,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -518,7 +493,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, domain_name=domain_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -539,9 +513,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}'} # type: ignore @distributed_trace def list( @@ -567,8 +542,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayCustomDomainResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -582,7 +555,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -595,7 +567,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -613,11 +584,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -630,4 +597,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py index 902e344daad..858df5ed1cc 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateway_route_configs_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,11 +37,10 @@ def build_get_request( route_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,21 +49,21 @@ def build_get_request( "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -80,12 +79,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -94,23 +93,23 @@ def build_create_or_update_request_initial( "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -125,11 +124,10 @@ def build_delete_request_initial( route_config_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -138,21 +136,21 @@ def build_delete_request_initial( "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -164,11 +162,10 @@ def build_list_request( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -176,21 +173,21 @@ def build_list_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -247,8 +244,6 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, @@ -256,17 +251,12 @@ def get( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -280,7 +270,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore def _create_or_update_initial( @@ -298,7 +288,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') @@ -309,7 +298,6 @@ def _create_or_update_initial( service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -317,11 +305,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -339,7 +323,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore @distributed_trace @@ -382,9 +366,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -398,7 +381,6 @@ def begin_create_or_update( gateway_name=gateway_name, route_config_name=route_config_name, gateway_route_config_resource=gateway_route_config_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -423,11 +405,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -441,8 +424,6 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -450,17 +431,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -470,11 +446,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -505,8 +481,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -519,7 +494,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements service_name=service_name, gateway_name=gateway_name, route_config_name=route_config_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -540,9 +514,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}'} # type: ignore @distributed_trace def list( @@ -568,8 +543,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayRouteConfigResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -583,7 +556,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -596,7 +568,6 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -614,11 +585,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -631,4 +598,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py index 010df16f444..e4994884358 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_gateways_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,11 +36,10 @@ def build_get_request( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -48,21 +47,21 @@ def build_get_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -77,12 +76,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -90,23 +89,23 @@ def build_create_or_update_request_initial( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -120,11 +119,10 @@ def build_delete_request_initial( gateway_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -132,21 +130,21 @@ def build_delete_request_initial( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -157,32 +155,31 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -197,12 +194,12 @@ def build_validate_domain_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -210,23 +207,23 @@ def build_validate_domain_request( "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -282,25 +279,18 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -314,7 +304,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore def _create_or_update_initial( @@ -331,7 +321,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(gateway_resource, 'GatewayResource') @@ -341,7 +330,6 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -349,11 +337,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -371,7 +355,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore @distributed_trace @@ -408,9 +392,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -423,7 +406,6 @@ def begin_create_or_update( service_name=service_name, gateway_name=gateway_name, gateway_resource=gateway_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -448,11 +430,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -465,25 +448,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -493,11 +469,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -525,8 +501,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -538,7 +513,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -559,9 +533,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}'} # type: ignore @distributed_trace def list( @@ -584,8 +559,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.GatewayResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -598,7 +571,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -610,7 +582,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -628,11 +599,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -645,7 +612,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways'} # type: ignore @distributed_trace def validate_domain( @@ -679,7 +646,6 @@ def validate_domain( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') @@ -689,7 +655,6 @@ def validate_domain( resource_group_name=resource_group_name, service_name=service_name, gateway_name=gateway_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.validate_domain.metadata['url'], @@ -697,11 +662,7 @@ def validate_domain( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -715,5 +676,5 @@ def validate_domain( return deserialized - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore + validate_domain.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py index a99be97950e..ad6ebde8e10 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_monitoring_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -18,6 +17,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,32 +34,31 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -73,35 +72,35 @@ def build_update_put_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -117,35 +116,35 @@ def build_update_patch_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -198,24 +197,17 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -229,7 +221,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_put_initial( @@ -245,7 +237,6 @@ def _update_put_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -254,7 +245,6 @@ def _update_put_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_put_initial.metadata['url'], @@ -262,11 +252,7 @@ def _update_put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -284,7 +270,7 @@ def _update_put_initial( return deserialized - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + _update_put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore @distributed_trace @@ -319,9 +305,8 @@ def begin_update_put( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -333,7 +318,6 @@ def begin_update_put( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -358,9 +342,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + begin_update_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore def _update_patch_initial( self, @@ -375,7 +360,6 @@ def _update_patch_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') @@ -384,7 +368,6 @@ def _update_patch_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_patch_initial.metadata['url'], @@ -392,11 +375,7 @@ def _update_patch_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -414,7 +393,7 @@ def _update_patch_initial( return deserialized - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + _update_patch_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore @distributed_trace @@ -449,9 +428,8 @@ def begin_update_patch( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.MonitoringSettingResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -463,7 +441,6 @@ def begin_update_patch( resource_group_name=resource_group_name, service_name=service_name, monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -488,6 +465,7 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore + begin_update_patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py index 22e18df017b..549e2419e09 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,25 +29,24 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/operations') # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -86,8 +85,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.AvailableOperations] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -97,7 +94,6 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -106,7 +102,6 @@ def prepare_request(next_link=None): else: request = build_list_request( - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -124,11 +119,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -141,4 +132,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore + list.metadata = {'url': '/providers/Microsoft.AppPlatform/operations'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py index 108f5a18aef..775f5aa2670 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_runtime_versions_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -16,6 +15,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -28,25 +28,24 @@ def build_list_runtime_versions_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") + url = kwargs.pop("template_url", '/providers/Microsoft.AppPlatform/runtimeVersions') # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -90,21 +89,14 @@ def list_runtime_versions( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_runtime_versions_request( - api_version=api_version, template_url=self.list_runtime_versions.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -118,5 +110,5 @@ def list_runtime_versions( return deserialized - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore + list_runtime_versions.metadata = {'url': '/providers/Microsoft.AppPlatform/runtimeVersions'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py index fd66664a624..afac5b0834e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_service_registries_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,11 +35,10 @@ def build_get_request( service_registry_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -47,21 +46,21 @@ def build_get_request( "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -73,11 +72,10 @@ def build_create_or_update_request_initial( service_registry_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -85,21 +83,21 @@ def build_create_or_update_request_initial( "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -111,11 +109,10 @@ def build_delete_request_initial( service_registry_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -123,21 +120,21 @@ def build_delete_request_initial( "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -148,32 +145,31 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -227,25 +223,18 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -259,7 +248,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore def _create_or_update_initial( @@ -275,25 +264,18 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_create_or_update_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, template_url=self._create_or_update_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -311,7 +293,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore @distributed_trace @@ -345,8 +327,7 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -358,7 +339,6 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -382,11 +362,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -399,25 +380,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -427,11 +401,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -459,8 +433,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -472,7 +445,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, service_registry_name=service_registry_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -493,9 +465,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}'} # type: ignore @distributed_trace def list( @@ -518,8 +491,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceRegistryResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -532,7 +503,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -544,7 +514,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -562,11 +531,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -579,4 +544,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py index 5bb8285dc5f..2b867ca842a 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,32 +35,31 @@ def build_get_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -74,35 +73,35 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -115,32 +114,31 @@ def build_delete_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -154,35 +152,35 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -195,32 +193,31 @@ def build_list_test_keys_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -234,35 +231,35 @@ def build_regenerate_test_key_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -275,32 +272,31 @@ def build_disable_test_endpoint_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -311,32 +307,31 @@ def build_enable_test_endpoint_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -347,32 +342,31 @@ def build_stop_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -383,32 +377,31 @@ def build_start_request_initial( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -421,34 +414,34 @@ def build_check_name_availability_request( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "location": _SERIALIZER.url("location", location, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -459,30 +452,29 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -492,31 +484,30 @@ def build_list_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -567,24 +558,17 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -598,7 +582,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _create_or_update_initial( @@ -614,7 +598,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -623,7 +606,6 @@ def _create_or_update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -631,11 +613,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -656,7 +634,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace @@ -690,9 +668,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -704,7 +681,6 @@ def begin_create_or_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -729,11 +705,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -745,24 +722,17 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -772,11 +742,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -801,8 +771,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -813,7 +782,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements raw_result = self._delete_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -834,9 +802,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore def _update_initial( self, @@ -851,7 +820,6 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(resource, 'ServiceResource') @@ -860,7 +828,6 @@ def _update_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -868,11 +835,7 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -890,7 +853,7 @@ def _update_initial( return deserialized - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace @@ -924,9 +887,8 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -938,7 +900,6 @@ def begin_update( resource_group_name=resource_group_name, service_name=service_name, resource=resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -963,9 +924,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}'} # type: ignore @distributed_trace def list_test_keys( @@ -992,24 +954,17 @@ def list_test_keys( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_list_test_keys_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list_test_keys.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1023,7 +978,7 @@ def list_test_keys( return deserialized - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore + list_test_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys'} # type: ignore @distributed_trace @@ -1055,7 +1010,6 @@ def regenerate_test_key( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') @@ -1064,7 +1018,6 @@ def regenerate_test_key( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self.regenerate_test_key.metadata['url'], @@ -1072,11 +1025,7 @@ def regenerate_test_key( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1090,11 +1039,11 @@ def regenerate_test_key( return deserialized - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore + regenerate_test_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey'} # type: ignore @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements + def disable_test_endpoint( self, resource_group_name: str, service_name: str, @@ -1118,24 +1067,17 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_disable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.disable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1145,7 +1087,7 @@ def disable_test_endpoint( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore + disable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint'} # type: ignore @distributed_trace @@ -1173,24 +1115,17 @@ def enable_test_endpoint( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_enable_test_endpoint_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.enable_test_endpoint.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1204,10 +1139,10 @@ def enable_test_endpoint( return deserialized - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore + enable_test_endpoint.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint'} # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, resource_group_name: str, service_name: str, @@ -1219,24 +1154,17 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_stop_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self._stop_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1246,11 +1174,11 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements + def begin_stop( self, resource_group_name: str, service_name: str, @@ -1275,8 +1203,7 @@ def begin_stop( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1287,7 +1214,6 @@ def begin_stop( # pylint: disable=inconsistent-return-statements raw_result = self._stop_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1308,11 +1234,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop'} # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements + def _start_initial( self, resource_group_name: str, service_name: str, @@ -1324,24 +1251,17 @@ def _start_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_start_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self._start_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: @@ -1351,11 +1271,11 @@ def _start_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements + def begin_start( self, resource_group_name: str, service_name: str, @@ -1380,8 +1300,7 @@ def begin_start( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1392,7 +1311,6 @@ def begin_start( # pylint: disable=inconsistent-return-statements raw_result = self._start_initial( resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -1413,9 +1331,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start'} # type: ignore @distributed_trace def check_name_availability( @@ -1442,7 +1361,6 @@ def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') @@ -1450,7 +1368,6 @@ def check_name_availability( request = build_check_name_availability_request( subscription_id=self._config.subscription_id, location=location, - api_version=api_version, content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], @@ -1458,11 +1375,7 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1476,7 +1389,7 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability'} # type: ignore @distributed_trace @@ -1492,8 +1405,6 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1504,7 +1415,6 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -1514,7 +1424,6 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1532,11 +1441,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1549,7 +1454,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring'} # type: ignore @distributed_trace def list( @@ -1568,8 +1473,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -1581,7 +1484,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -1592,7 +1494,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -1610,11 +1511,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -1627,4 +1524,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py index eac243f1d68..8bfd5f9726e 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -17,6 +16,7 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -30,30 +30,29 @@ def build_list_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -93,8 +92,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.ResourceSkuCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -105,7 +102,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -115,7 +111,6 @@ def prepare_request(next_link=None): request = build_list_request( subscription_id=self._config.subscription_id, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -133,11 +128,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -150,4 +141,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus'} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py index bff9a55bc88..d8743b9cea8 100644 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/operations/_storages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -19,6 +18,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,11 +36,10 @@ def build_get_request( storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -48,21 +47,21 @@ def build_get_request( "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -77,12 +76,12 @@ def build_create_or_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -90,23 +89,23 @@ def build_create_or_update_request_initial( "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, json=json, content=content, **kwargs @@ -120,11 +119,10 @@ def build_delete_request_initial( storage_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -132,21 +130,21 @@ def build_delete_request_initial( "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -157,32 +155,31 @@ def build_list_request( service_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - + api_version = "2022-03-01-preview" accept = "application/json" # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # pylint: disable=line-too-long + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages') path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), } - _url = _format_url_section(_url, **path_format_arguments) + url = _format_url_section(url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, + url=url, + params=query_parameters, + headers=header_parameters, **kwargs ) @@ -236,25 +233,18 @@ def get( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -268,7 +258,7 @@ def get( return deserialized - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore def _create_or_update_initial( @@ -285,7 +275,6 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(storage_resource, 'StorageResource') @@ -295,7 +284,6 @@ def _create_or_update_initial( resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], @@ -303,11 +291,7 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: @@ -328,7 +312,7 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore @distributed_trace @@ -365,9 +349,8 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResource] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -380,7 +363,6 @@ def begin_create_or_update( service_name=service_name, storage_name=storage_name, storage_resource=storage_resource, - api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -405,11 +387,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, service_name: str, @@ -422,25 +405,18 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop('error_map', {})) - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -450,11 +426,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements + def begin_delete( self, resource_group_name: str, service_name: str, @@ -482,8 +458,7 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -495,7 +470,6 @@ def begin_delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, service_name=service_name, storage_name=storage_name, - api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -516,9 +490,10 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}'} # type: ignore @distributed_trace def list( @@ -541,8 +516,6 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_03_01_preview.models.StorageResourceCollection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -555,7 +528,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -567,7 +539,6 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, service_name=service_name, - api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -585,11 +556,7 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: @@ -602,4 +569,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages'} # type: ignore From 0fb6170514670d2d1c8656e5d5b891bb0fb7cf58 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Wed, 18 May 2022 15:25:49 +0800 Subject: [PATCH 03/21] update sdk --- .../appplatform/v2020_07_01/_patch.py | 31 - .../appplatform/v2020_07_01/_vendor.py | 27 - .../appplatform/v2020_07_01/aio/_patch.py | 31 - .../appplatform/v2020_11_01_preview/_patch.py | 31 - .../v2020_11_01_preview/_vendor.py | 27 - .../v2020_11_01_preview/aio/_patch.py | 31 - .../appplatform/v2021_06_01_preview/_patch.py | 31 - .../v2021_06_01_preview/_vendor.py | 27 - .../v2021_06_01_preview/aio/_patch.py | 31 - .../appplatform/v2021_09_01_preview/_patch.py | 31 - .../v2021_09_01_preview/_vendor.py | 27 - .../v2021_09_01_preview/aio/_patch.py | 31 - .../appplatform/v2022_01_01_preview/_patch.py | 31 - .../v2022_01_01_preview/_vendor.py | 27 - .../v2022_01_01_preview/aio/_patch.py | 31 - .../appplatform/v2022_03_01_preview/_patch.py | 31 - .../v2022_03_01_preview/_vendor.py | 27 - .../v2022_03_01_preview/aio/_patch.py | 31 - .../appplatform/v2022_04_01/__init__.py | 18 - .../_app_platform_management_client.py | 153 - .../appplatform/v2022_04_01/_configuration.py | 74 - .../appplatform/v2022_04_01/_patch.py | 31 - .../appplatform/v2022_04_01/_vendor.py | 27 - .../appplatform/v2022_04_01/_version.py | 9 - .../appplatform/v2022_04_01/aio/__init__.py | 15 - .../aio/_app_platform_management_client.py | 153 - .../v2022_04_01/aio/_configuration.py | 73 - .../appplatform/v2022_04_01/aio/_patch.py | 31 - .../v2022_04_01/aio/operations/__init__.py | 45 - .../aio/operations/_apps_operations.py | 852 --- .../aio/operations/_bindings_operations.py | 606 -- .../_build_service_agent_pool_operations.py | 346 - .../_build_service_builder_operations.py | 462 -- .../operations/_build_service_operations.py | 985 --- .../_buildpack_binding_operations.py | 483 -- .../operations/_certificates_operations.py | 444 -- .../operations/_config_servers_operations.py | 492 -- .../_configuration_services_operations.py | 578 -- .../operations/_custom_domains_operations.py | 606 -- .../aio/operations/_deployments_operations.py | 1504 ----- .../_monitoring_settings_operations.py | 365 -- .../v2022_04_01/aio/operations/_operations.py | 115 - .../_runtime_versions_operations.py | 93 - .../_service_registries_operations.py | 430 -- .../aio/operations/_services_operations.py | 925 --- .../aio/operations/_skus_operations.py | 118 - .../v2022_04_01/models/__init__.py | 327 - .../_app_platform_management_client_enums.py | 249 - .../v2022_04_01/models/_models_py3.py | 5766 ----------------- .../v2022_04_01/operations/__init__.py | 45 - .../operations/_apps_operations.py | 1190 ---- .../operations/_bindings_operations.py | 823 --- .../_build_service_agent_pool_operations.py | 475 -- .../_build_service_builder_operations.py | 631 -- .../operations/_build_service_operations.py | 1506 ----- .../_buildpack_binding_operations.py | 660 -- .../operations/_certificates_operations.py | 605 -- .../operations/_config_servers_operations.py | 664 -- .../_configuration_services_operations.py | 785 --- .../operations/_custom_domains_operations.py | 823 --- .../operations/_deployments_operations.py | 2069 ------ .../_monitoring_settings_operations.py | 493 -- .../v2022_04_01/operations/_operations.py | 144 - .../_runtime_versions_operations.py | 122 - .../_service_registries_operations.py | 582 -- .../operations/_services_operations.py | 1348 ---- .../operations/_skus_operations.py | 153 - 67 files changed, 30027 deletions(-) delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_07_01/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2020_11_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_06_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2021_09_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_01_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py deleted file mode 100644 index 41ec6d71ff7..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/__init__.py +++ /dev/null @@ -1,18 +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 ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION -__all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py deleted file mode 100644 index f50df2a4890..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_app_platform_management_client.py +++ /dev/null @@ -1,153 +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 copy import deepcopy -from typing import Any, TYPE_CHECKING - -from msrest import Deserializer, Serializer - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_04_01.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: azure.mgmt.appplatform.v2022_04_01.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_04_01.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_04_01.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_04_01.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_04_01.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_04_01.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_04_01.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_04_01.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_04_01.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: azure.mgmt.appplatform.v2022_04_01.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_04_01.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_04_01.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_04_01.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_04_01.operations.SkusOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> AppPlatformManagementClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py deleted file mode 100644 index c776f7eae7d..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_configuration.py +++ /dev/null @@ -1,74 +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, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AppPlatformManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py deleted file mode 100644 index 92453d8691d..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "6.1.0" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py deleted file mode 100644 index 44ce4a5043f..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/__init__.py +++ /dev/null @@ -1,15 +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 ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py deleted file mode 100644 index a1b2fd42062..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_app_platform_management_client.py +++ /dev/null @@ -1,153 +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 copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from msrest import Deserializer, Serializer - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_04_01.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_04_01.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_04_01.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_04_01.aio.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_04_01.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_04_01.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_04_01.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_04_01.aio.operations.BindingsOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: azure.mgmt.appplatform.v2022_04_01.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_04_01.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: azure.mgmt.appplatform.v2022_04_01.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_04_01.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_04_01.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_04_01.aio.operations.SkusOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AppPlatformManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py deleted file mode 100644 index 55d91609d50..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_configuration.py +++ /dev/null @@ -1,73 +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, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AppPlatformManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py deleted file mode 100644 index 152a0c3a076..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/__init__.py +++ /dev/null @@ -1,45 +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 ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._build_service_operations import BuildServiceOperations -from ._buildpack_binding_operations import BuildpackBindingOperations -from ._build_service_builder_operations import BuildServiceBuilderOperations -from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -__all__ = [ - 'ServicesOperations', - 'ConfigServersOperations', - 'ConfigurationServicesOperations', - 'ServiceRegistriesOperations', - 'BuildServiceOperations', - 'BuildpackBindingOperations', - 'BuildServiceBuilderOperations', - 'BuildServiceAgentPoolOperations', - 'MonitoringSettingsOperations', - 'AppsOperations', - 'BindingsOperations', - 'CertificatesOperations', - 'CustomDomainsOperations', - 'DeploymentsOperations', - 'Operations', - 'RuntimeVersionsOperations', - 'SkusOperations', -] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py deleted file mode 100644 index 32b8e642d9b..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_apps_operations.py +++ /dev/null @@ -1,852 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_set_active_deployments_request_initial, build_update_request_initial, build_validate_domain_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class AppsOperations: - """AppsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": - """Get an App and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AppResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.AppResource"]: - """Create a new App or update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the create or update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.AppResource"]: - """Operation to update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.AppResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AppResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore - - @distributed_trace_async - async def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for an App, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - - request = build_set_active_deployments_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._set_active_deployments_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> AsyncLROPoller["_models.AppResource"]: - """Set existing Deployment under the app as active. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._set_active_deployments_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - active_deployment_collection=active_deployment_collection, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the resource name is valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py deleted file mode 100644 index fa1a87d93b4..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BindingsOperations: - """BindingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": - """Get a Binding and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BindingResource"]: - """Create a new Binding or update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BindingResource"]: - """Operation to update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BindingResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 44f4ab35cbc..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,346 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_agent_pool_operations import build_get_request, build_list_request, build_update_put_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildServiceAgentPoolOperations: - """BuildServiceAgentPoolOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResourceCollection"]: - """List build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - """Get build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildServiceAgentPoolResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BuildServiceAgentPoolResource"]: - """Create or update build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - agent_pool_resource=agent_pool_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 035d3d8564e..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,462 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_builder_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildServiceBuilderOperations: - """BuildServiceBuilderOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> "_models.BuilderResource": - """Get a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuilderResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> "_models.BuilderResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(builder_resource, 'BuilderResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BuilderResource"]: - """Create or update a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. - :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - builder_resource=builder_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuilderResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuilderResourceCollection"]: - """List KPack builders result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py deleted file mode 100644 index 20a7b61d88b..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,985 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_operations import build_create_or_update_build_request, build_get_build_request, build_get_build_result_log_request, build_get_build_result_request, build_get_build_service_request, build_get_resource_upload_url_request, build_get_supported_buildpack_request, build_get_supported_stack_request, build_list_build_results_request, build_list_build_services_request, build_list_builds_request, build_list_supported_buildpacks_request, build_list_supported_stacks_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildServiceOperations: - """BuildServiceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_build_services( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceCollection"]: - """List build services resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_build_services.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore - - @distributed_trace_async - async def get_build_service( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.BuildService": - """Get a build service resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildService, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildService - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_service_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_build_service.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildService', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore - - - @distributed_trace - def list_builds( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildCollection"]: - """List KPack builds. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_builds.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore - - @distributed_trace_async - async def get_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> "_models.Build": - """Get a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.get_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace_async - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: "_models.Build", - **kwargs: Any - ) -> "_models.Build": - """Create or update a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build: Parameters for the create or update operation. - :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(build, 'Build') - - request = build_create_or_update_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Build', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace - def list_build_results( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildResultCollection"]: - """List KPack build results. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildResultCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.list_build_results.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildResultCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore - - @distributed_trace_async - async def get_build_result( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResult": - """Get a KPack build result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_result_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore - - - @distributed_trace_async - async def get_build_result_log( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResultLog": - """Get a KPack build result log download URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResultLog, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultLog - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_result_log_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result_log.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResultLog', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore - - - @distributed_trace_async - async def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for build service, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace_async - async def list_supported_buildpacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpacksCollection": - """Get all supported buildpacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_supported_buildpacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_buildpacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore - - - @distributed_trace_async - async def get_supported_buildpack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpackResource": - """Get the supported buildpack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. - :type buildpack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_supported_buildpack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - api_version=api_version, - template_url=self.get_supported_buildpack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore - - - @distributed_trace_async - async def list_supported_stacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedStacksCollection": - """Get all supported stacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_supported_stacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_stacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore - - - @distributed_trace_async - async def get_supported_stack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any - ) -> "_models.SupportedStackResource": - """Get the supported stack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param stack_name: The name of the stack resource. - :type stack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_supported_stack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - api_version=api_version, - template_url=self.get_supported_stack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 2a82f70139d..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,483 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._buildpack_binding_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildpackBindingOperations: - """BuildpackBindingOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - """Get a buildpack binding by name. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildpackBindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BuildpackBindingResource"]: - """Create or update a buildpack binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - buildpack_binding=buildpack_binding, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Buildpack Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResourceCollection"]: - """Handles requests to list all buildpack bindings in a builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py deleted file mode 100644 index 0d13838915e..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,444 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class CertificatesOperations: - """CertificatesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": - """Get the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.CertificateResource"]: - """Create or update certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateResourceCollection"]: - """List all the certificates of one user. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py deleted file mode 100644 index 2f3f8835732..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,492 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ConfigServersOperations: - """ConfigServersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": - """Get the config server and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigServerResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]: - """Check if the config server settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py deleted file mode 100644 index 4f4501b3c65..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,578 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._configuration_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ConfigurationServicesOperations: - """ConfigurationServicesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - """Get the Application Configuration Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigurationServiceResource"]: - """Create the default Application Configuration Service or update the existing Application - Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> "_models.ConfigurationServiceSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(settings, 'ConfigurationServiceSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore - - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigurationServiceSettingsValidateResult"]: - """Check if the Application Configuration Service settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. - :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - settings=settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py deleted file mode 100644 index b5eb552c2fe..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class CustomDomainsOperations: - """CustomDomainsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": - """Get the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.CustomDomainResource"]: - """Create or update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.CustomDomainResource"]: - """Update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: - """List the custom domains of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py deleted file mode 100644 index 391901a14aa..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,1504 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """DeploymentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": - """Get a Deployment and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.DeploymentResource"]: - """Create a new Deployment or update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.DeploymentResource"]: - """Operation to update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResourceCollection"]: - """List deployments for a certain service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Start the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Stop the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - - @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - @distributed_trace_async - async def get_log_file_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: - """Get deployment log file URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogFileUrlResponse, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.LogFileUrlResponse or None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - - @distributed_trace_async - async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Generate Heap Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._generate_heap_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - - @distributed_trace_async - async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Generate Thread Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._generate_thread_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore - - - @distributed_trace_async - async def begin_start_jfr( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Start JFR. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_jfr_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index be988d6a031..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,365 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MonitoringSettingsOperations: - """MonitoringSettingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - """Get the Monitoring Setting and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MonitoringSettingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py deleted file mode 100644 index 4fcb09a84df..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_operations.py +++ /dev/null @@ -1,115 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.AvailableOperations"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AvailableOperations] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index 8175b0d2faf..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._runtime_versions_operations import build_list_runtime_versions_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RuntimeVersionsOperations: - """RuntimeVersionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def list_runtime_versions( - self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailableRuntimeVersions, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AvailableRuntimeVersions - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py deleted file mode 100644 index 6e74add2398..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,430 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._service_registries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ServiceRegistriesOperations: - """ServiceRegistriesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - """Get the Service Registry and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceRegistryResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceRegistryResource"]: - """Create the default Service Registry or update the existing Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py deleted file mode 100644 index 5aa861619df..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_services_operations.py +++ /dev/null @@ -1,925 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ServicesOperations: - """ServicesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": - """Get a Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: - """Create a new Service or update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the create or update operation. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: - """Operation to update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the update operation. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace_async - async def list_test_keys( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """List test keys for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": - """Regenerate a test key for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - """Disable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - - - @distributed_trace_async - async def enable_test_endpoint( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """Enable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": - """Checks that the resource name is valid and is not already in use. - - :param location: the region. - :type location: str - :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailability, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NameAvailability', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a resource group. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py deleted file mode 100644 index e78d8b07fc1..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/aio/operations/_skus_operations.py +++ /dev/null @@ -1,118 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class SkusOperations: - """SkusOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ResourceSkuCollection"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py deleted file mode 100644 index 1964396464b..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/__init__.py +++ /dev/null @@ -1,327 +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 ._models_py3 import ActiveDeploymentCollection -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import AvailableOperations -from ._models_py3 import AvailableRuntimeVersions -from ._models_py3 import BindingResource -from ._models_py3 import BindingResourceCollection -from ._models_py3 import BindingResourceProperties -from ._models_py3 import Build -from ._models_py3 import BuildCollection -from ._models_py3 import BuildProperties -from ._models_py3 import BuildResult -from ._models_py3 import BuildResultCollection -from ._models_py3 import BuildResultLog -from ._models_py3 import BuildResultProperties -from ._models_py3 import BuildResultUserSourceInfo -from ._models_py3 import BuildService -from ._models_py3 import BuildServiceAgentPoolProperties -from ._models_py3 import BuildServiceAgentPoolResource -from ._models_py3 import BuildServiceAgentPoolResourceCollection -from ._models_py3 import BuildServiceAgentPoolSizeProperties -from ._models_py3 import BuildServiceCollection -from ._models_py3 import BuildServiceProperties -from ._models_py3 import BuildServicePropertiesResourceRequests -from ._models_py3 import BuildStageProperties -from ._models_py3 import BuilderProperties -from ._models_py3 import BuilderResource -from ._models_py3 import BuilderResourceCollection -from ._models_py3 import BuildpackBindingLaunchProperties -from ._models_py3 import BuildpackBindingProperties -from ._models_py3 import BuildpackBindingResource -from ._models_py3 import BuildpackBindingResourceCollection -from ._models_py3 import BuildpackProperties -from ._models_py3 import BuildpacksGroupProperties -from ._models_py3 import CertificateProperties -from ._models_py3 import CertificateResource -from ._models_py3 import CertificateResourceCollection -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterResourceProperties -from ._models_py3 import ConfigServerGitProperty -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerSettings -from ._models_py3 import ConfigServerSettingsErrorRecord -from ._models_py3 import ConfigServerSettingsValidateResult -from ._models_py3 import ConfigurationServiceGitProperty -from ._models_py3 import ConfigurationServiceGitPropertyValidateResult -from ._models_py3 import ConfigurationServiceGitRepository -from ._models_py3 import ConfigurationServiceInstance -from ._models_py3 import ConfigurationServiceProperties -from ._models_py3 import ConfigurationServiceResource -from ._models_py3 import ConfigurationServiceResourceCollection -from ._models_py3 import ConfigurationServiceResourceRequests -from ._models_py3 import ConfigurationServiceSettings -from ._models_py3 import ConfigurationServiceSettingsValidateResult -from ._models_py3 import ContentCertificateProperties -from ._models_py3 import CustomDomainProperties -from ._models_py3 import CustomDomainResource -from ._models_py3 import CustomDomainResourceCollection -from ._models_py3 import CustomDomainValidatePayload -from ._models_py3 import CustomDomainValidateResult -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import GitPatternRepository -from ._models_py3 import JarUploadedUserSourceInfo -from ._models_py3 import KeyVaultCertificateProperties -from ._models_py3 import LoadedCertificate -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import MonitoringSettingProperties -from ._models_py3 import MonitoringSettingResource -from ._models_py3 import NameAvailability -from ._models_py3 import NameAvailabilityParameters -from ._models_py3 import NetCoreZipUploadedUserSourceInfo -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileOutboundIPs -from ._models_py3 import OperationDetail -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationProperties -from ._models_py3 import PersistentDisk -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RequiredTraffic -from ._models_py3 import Resource -from ._models_py3 import ResourceRequests -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuCapabilities -from ._models_py3 import ResourceSkuCollection -from ._models_py3 import ResourceSkuLocationInfo -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import ResourceSkuZoneDetails -from ._models_py3 import ResourceUploadDefinition -from ._models_py3 import ServiceRegistryInstance -from ._models_py3 import ServiceRegistryProperties -from ._models_py3 import ServiceRegistryResource -from ._models_py3 import ServiceRegistryResourceCollection -from ._models_py3 import ServiceRegistryResourceRequests -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceList -from ._models_py3 import ServiceSpecification -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SourceUploadedUserSourceInfo -from ._models_py3 import StackProperties -from ._models_py3 import SupportedBuildpackResource -from ._models_py3 import SupportedBuildpackResourceProperties -from ._models_py3 import SupportedBuildpacksCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SupportedStackResource -from ._models_py3 import SupportedStackResourceProperties -from ._models_py3 import SupportedStacksCollection -from ._models_py3 import SystemData -from ._models_py3 import TemporaryDisk -from ._models_py3 import TestKeys -from ._models_py3 import TrackedResource -from ._models_py3 import TriggeredBuildResult -from ._models_py3 import UploadedUserSourceInfo -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - - -from ._app_platform_management_client_enums import ( - ActionType, - AppResourceProvisioningState, - BindingType, - BuildProvisioningState, - BuildResultProvisioningState, - BuildServiceProvisioningState, - BuilderProvisioningState, - BuildpackBindingProvisioningState, - ConfigServerState, - ConfigurationServiceProvisioningState, - CreatedByType, - DeploymentResourceProvisioningState, - DeploymentResourceStatus, - KPackBuildStageProvisioningState, - LastModifiedByType, - ManagedIdentityType, - MonitoringSettingState, - ProvisioningState, - ResourceSkuRestrictionsReasonCode, - ResourceSkuRestrictionsType, - ServiceRegistryProvisioningState, - SkuScaleType, - SupportedRuntimePlatform, - SupportedRuntimeValue, - TestKeyType, - TrafficDirection, -) - -__all__ = [ - 'ActiveDeploymentCollection', - 'AppResource', - 'AppResourceCollection', - 'AppResourceProperties', - 'ApplicationInsightsAgentVersions', - 'AvailableOperations', - 'AvailableRuntimeVersions', - 'BindingResource', - 'BindingResourceCollection', - 'BindingResourceProperties', - 'Build', - 'BuildCollection', - 'BuildProperties', - 'BuildResult', - 'BuildResultCollection', - 'BuildResultLog', - 'BuildResultProperties', - 'BuildResultUserSourceInfo', - 'BuildService', - 'BuildServiceAgentPoolProperties', - 'BuildServiceAgentPoolResource', - 'BuildServiceAgentPoolResourceCollection', - 'BuildServiceAgentPoolSizeProperties', - 'BuildServiceCollection', - 'BuildServiceProperties', - 'BuildServicePropertiesResourceRequests', - 'BuildStageProperties', - 'BuilderProperties', - 'BuilderResource', - 'BuilderResourceCollection', - 'BuildpackBindingLaunchProperties', - 'BuildpackBindingProperties', - 'BuildpackBindingResource', - 'BuildpackBindingResourceCollection', - 'BuildpackProperties', - 'BuildpacksGroupProperties', - 'CertificateProperties', - 'CertificateResource', - 'CertificateResourceCollection', - 'CloudErrorBody', - 'ClusterResourceProperties', - 'ConfigServerGitProperty', - 'ConfigServerProperties', - 'ConfigServerResource', - 'ConfigServerSettings', - 'ConfigServerSettingsErrorRecord', - 'ConfigServerSettingsValidateResult', - 'ConfigurationServiceGitProperty', - 'ConfigurationServiceGitPropertyValidateResult', - 'ConfigurationServiceGitRepository', - 'ConfigurationServiceInstance', - 'ConfigurationServiceProperties', - 'ConfigurationServiceResource', - 'ConfigurationServiceResourceCollection', - 'ConfigurationServiceResourceRequests', - 'ConfigurationServiceSettings', - 'ConfigurationServiceSettingsValidateResult', - 'ContentCertificateProperties', - 'CustomDomainProperties', - 'CustomDomainResource', - 'CustomDomainResourceCollection', - 'CustomDomainValidatePayload', - 'CustomDomainValidateResult', - 'DeploymentInstance', - 'DeploymentResource', - 'DeploymentResourceCollection', - 'DeploymentResourceProperties', - 'DeploymentSettings', - 'DiagnosticParameters', - 'Error', - 'GitPatternRepository', - 'JarUploadedUserSourceInfo', - 'KeyVaultCertificateProperties', - 'LoadedCertificate', - 'LogFileUrlResponse', - 'LogSpecification', - 'ManagedIdentityProperties', - 'MetricDimension', - 'MetricSpecification', - 'MonitoringSettingProperties', - 'MonitoringSettingResource', - 'NameAvailability', - 'NameAvailabilityParameters', - 'NetCoreZipUploadedUserSourceInfo', - 'NetworkProfile', - 'NetworkProfileOutboundIPs', - 'OperationDetail', - 'OperationDisplay', - 'OperationProperties', - 'PersistentDisk', - 'ProxyResource', - 'RegenerateTestKeyRequestPayload', - 'RequiredTraffic', - 'Resource', - 'ResourceRequests', - 'ResourceSku', - 'ResourceSkuCapabilities', - 'ResourceSkuCollection', - 'ResourceSkuLocationInfo', - 'ResourceSkuRestrictionInfo', - 'ResourceSkuRestrictions', - 'ResourceSkuZoneDetails', - 'ResourceUploadDefinition', - 'ServiceRegistryInstance', - 'ServiceRegistryProperties', - 'ServiceRegistryResource', - 'ServiceRegistryResourceCollection', - 'ServiceRegistryResourceRequests', - 'ServiceResource', - 'ServiceResourceList', - 'ServiceSpecification', - 'Sku', - 'SkuCapacity', - 'SourceUploadedUserSourceInfo', - 'StackProperties', - 'SupportedBuildpackResource', - 'SupportedBuildpackResourceProperties', - 'SupportedBuildpacksCollection', - 'SupportedRuntimeVersion', - 'SupportedStackResource', - 'SupportedStackResourceProperties', - 'SupportedStacksCollection', - 'SystemData', - 'TemporaryDisk', - 'TestKeys', - 'TrackedResource', - 'TriggeredBuildResult', - 'UploadedUserSourceInfo', - 'UserSourceInfo', - 'ValidationMessages', - 'ActionType', - 'AppResourceProvisioningState', - 'BindingType', - 'BuildProvisioningState', - 'BuildResultProvisioningState', - 'BuildServiceProvisioningState', - 'BuilderProvisioningState', - 'BuildpackBindingProvisioningState', - 'ConfigServerState', - 'ConfigurationServiceProvisioningState', - 'CreatedByType', - 'DeploymentResourceProvisioningState', - 'DeploymentResourceStatus', - 'KPackBuildStageProvisioningState', - 'LastModifiedByType', - 'ManagedIdentityType', - 'MonitoringSettingState', - 'ProvisioningState', - 'ResourceSkuRestrictionsReasonCode', - 'ResourceSkuRestrictionsType', - 'ServiceRegistryProvisioningState', - 'SkuScaleType', - 'SupportedRuntimePlatform', - 'SupportedRuntimeValue', - 'TestKeyType', - 'TrafficDirection', -] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py deleted file mode 100644 index ac9fe9b1e93..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,249 +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 enum import Enum -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ - - INTERNAL = "Internal" - -class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the App - """ - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - -class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Buildpack Binding Type - """ - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - -class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Builder provision status. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Buildpack Binding. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the KPack build result - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the KPack build result - """ - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the KPack build result - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the config server. - """ - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - -class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Application Configuration Service. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that created the resource. - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the Deployment - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - -class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Status of the Deployment - """ - - STOPPED = "Stopped" - RUNNING = "Running" - -class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The provisioning state of this build stage resource. - """ - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - -class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that last modified the resource. - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of the managed identity - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - -class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Monitoring Setting. - """ - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the Service - """ - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - -class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription' - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - -class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone' - """ - - LOCATION = "Location" - ZONE = "Zone" - -class ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Service Registry. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets or sets the type of the scale. - """ - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - -class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The platform of this runtime version (possible values: "Java" or ".NET"). - """ - - JAVA = "Java" - _NET_CORE = ".NET Core" - -class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The raw value which could be passed to deployment CRUD operations. - """ - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - JAVA17 = "Java_17" - NET_CORE31 = "NetCore_31" - -class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of the test key - """ - - PRIMARY = "Primary" - SECONDARY = "Secondary" - -class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The direction of required traffic - """ - - INBOUND = "Inbound" - OUTBOUND = "Outbound" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py deleted file mode 100644 index 44ea53e7708..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/models/_models_py3.py +++ /dev/null @@ -1,5766 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, Union - -import msrest.serialization - -from ._app_platform_management_client_enums import * - - -class ActiveDeploymentCollection(msrest.serialization.Model): - """Object that includes an array of Deployment resource name and set them as active. - - :ivar active_deployment_names: Collection of Deployment name. - :vartype active_deployment_names: list[str] - """ - - _attribute_map = { - 'active_deployment_names': {'key': 'activeDeploymentNames', 'type': '[str]'}, - } - - def __init__( - self, - *, - active_deployment_names: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super(ActiveDeploymentCollection, self).__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApplicationInsightsAgentVersions(msrest.serialization.Model): - """Application Insights agent versions properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar java: Indicates the version of application insight java agent. - :vartype java: str - """ - - _validation = { - 'java': {'readonly': True}, - } - - _attribute_map = { - 'java': {'key': 'java', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) - self.java = None - - -class Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ProxyResource, self).__init__(**kwargs) - - -class AppResource(ProxyResource): - """App resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityProperties - :ivar location: The GEO location of the application, always the same with its parent resource. - :vartype location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'AppResourceProperties'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentityProperties'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - *, - properties: Optional["AppResourceProperties"] = None, - identity: Optional["ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs - ): - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super(AppResource, self).__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(msrest.serialization.Model): - """Object that includes an array of App resources and a possible link for next set. - - :ivar value: Collection of App resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AppResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["AppResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(AppResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(msrest.serialization.Model): - """App resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public: Indicates whether the App exposes public endpoint. - :vartype public: bool - :ivar url: URL of the App. - :vartype url: str - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, dict[str, any]] - :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", - "Failed", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.AppResourceProvisioningState - :ivar fqdn: Fully qualified dns Name. - :vartype fqdn: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool - :ivar temporary_disk: Temporary disk settings. - :vartype temporary_disk: ~azure.mgmt.appplatform.v2022_04_01.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_04_01.models.PersistentDisk - :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :vartype enable_end_to_end_tls: bool - :ivar loaded_certificates: Collection of loaded certificates. - :vartype loaded_certificates: - list[~azure.mgmt.appplatform.v2022_04_01.models.LoadedCertificate] - """ - - _validation = { - 'url': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'public': {'key': 'public', 'type': 'bool'}, - 'url': {'key': 'url', 'type': 'str'}, - 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, - 'temporary_disk': {'key': 'temporaryDisk', 'type': 'TemporaryDisk'}, - 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, - 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, - 'loaded_certificates': {'key': 'loadedCertificates', 'type': '[LoadedCertificate]'}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, - fqdn: Optional[str] = None, - https_only: Optional[bool] = False, - temporary_disk: Optional["TemporaryDisk"] = None, - persistent_disk: Optional["PersistentDisk"] = None, - enable_end_to_end_tls: Optional[bool] = False, - loaded_certificates: Optional[List["LoadedCertificate"]] = None, - **kwargs - ): - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, dict[str, any]] - :keyword fqdn: Fully qualified dns Name. - :paramtype fqdn: str - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword temporary_disk: Temporary disk settings. - :paramtype temporary_disk: ~azure.mgmt.appplatform.v2022_04_01.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_04_01.models.PersistentDisk - :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :paramtype enable_end_to_end_tls: bool - :keyword loaded_certificates: Collection of loaded certificates. - :paramtype loaded_certificates: - list[~azure.mgmt.appplatform.v2022_04_01.models.LoadedCertificate] - """ - super(AppResourceProperties, self).__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = fqdn - self.https_only = https_only - self.temporary_disk = temporary_disk - self.persistent_disk = persistent_disk - self.enable_end_to_end_tls = enable_end_to_end_tls - self.loaded_certificates = loaded_certificates - - -class AvailableOperations(msrest.serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.OperationDetail] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["OperationDetail"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.OperationDetail] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(AvailableOperations, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(msrest.serialization.Model): - """AvailableRuntimeVersions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of all supported runtime versions. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeVersion] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AvailableRuntimeVersions, self).__init__(**kwargs) - self.value = None - - -class BindingResource(ProxyResource): - """Binding resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceProperties - """ - - _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': 'BindingResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BindingResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceProperties - """ - super(BindingResource, self).__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(msrest.serialization.Model): - """Object that includes an array of Binding resources and a possible link for next set. - - :ivar value: Collection of Binding resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BindingResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(msrest.serialization.Model): - """Binding resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_name: The name of the bound resource. - :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound resource. - :vartype resource_type: str - :ivar resource_id: The Azure resource id of the bound resource. - :vartype resource_id: str - :ivar key: The key of the bound resource. - :vartype key: str - :ivar binding_parameters: Binding parameters of the Binding resource. - :vartype binding_parameters: dict[str, any] - :ivar generated_properties: The generated Spring Boot property file for this binding. The - secret will be deducted. - :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource. - :vartype created_at: str - :ivar updated_at: Update time of the Binding resource. - :vartype updated_at: str - """ - - _validation = { - 'resource_name': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'generated_properties': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - } - - _attribute_map = { - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'binding_parameters': {'key': 'bindingParameters', 'type': '{object}'}, - 'generated_properties': {'key': 'generatedProperties', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'str'}, - 'updated_at': {'key': 'updatedAt', 'type': 'str'}, - } - - def __init__( - self, - *, - resource_id: Optional[str] = None, - key: Optional[str] = None, - binding_parameters: Optional[Dict[str, Any]] = None, - **kwargs - ): - """ - :keyword resource_id: The Azure resource id of the bound resource. - :paramtype resource_id: str - :keyword key: The key of the bound resource. - :paramtype key: str - :keyword binding_parameters: Binding parameters of the Binding resource. - :paramtype binding_parameters: dict[str, any] - """ - super(BindingResourceProperties, self).__init__(**kwargs) - self.resource_name = None - self.resource_type = None - self.resource_id = resource_id - self.key = key - self.binding_parameters = binding_parameters - self.generated_properties = None - self.created_at = None - self.updated_at = None - - -class Build(ProxyResource): - """Build resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildProperties - """ - - _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': 'BuildProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildProperties - """ - super(Build, self).__init__(**kwargs) - self.properties = properties - - -class BuildCollection(msrest.serialization.Model): - """Object that includes an array of Build resources and a possible link for next set. - - :ivar value: Collection of Build resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.Build] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Build]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["Build"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.Build] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(msrest.serialization.Model): - """KPack Builder properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Builder provision status. Possible values include: "Creating", - "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_04_01.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpacksGroupProperties] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stack': {'key': 'stack', 'type': 'StackProperties'}, - 'buildpack_groups': {'key': 'buildpackGroups', 'type': '[BuildpacksGroupProperties]'}, - } - - def __init__( - self, - *, - stack: Optional["StackProperties"] = None, - buildpack_groups: Optional[List["BuildpacksGroupProperties"]] = None, - **kwargs - ): - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_04_01.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpacksGroupProperties] - """ - super(BuilderProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.stack = stack - self.buildpack_groups = buildpack_groups - - -class BuilderResource(ProxyResource): - """KPack Builder 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProperties - """ - - _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': 'BuilderProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuilderProperties"] = None, - **kwargs - ): - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderProperties - """ - super(BuilderResource, self).__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(msrest.serialization.Model): - """Object that includes an array of Builder resources and a possible link for next set. - - :ivar value: Collection of Builder resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuilderResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuilderResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuilderResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(msrest.serialization.Model): - """Buildpack Binding Launch Properties. - - :ivar properties: Non-sensitive properties for launchProperties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for launchProperties. - :vartype secrets: dict[str, str] - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'secrets': {'key': 'secrets', 'type': '{str}'}, - } - - def __init__( - self, - *, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super(BuildpackBindingLaunchProperties, self).__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(msrest.serialization.Model): - """Properties of a buildpack binding. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Possible values include: "Creating", - "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingLaunchProperties - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'binding_type': {'key': 'bindingType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'launch_properties': {'key': 'launchProperties', 'type': 'BuildpackBindingLaunchProperties'}, - } - - def __init__( - self, - *, - binding_type: Optional[Union[str, "BindingType"]] = None, - launch_properties: Optional["BuildpackBindingLaunchProperties"] = None, - **kwargs - ): - """ - :keyword binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingLaunchProperties - """ - super(BuildpackBindingProperties, self).__init__(**kwargs) - self.binding_type = binding_type - self.provisioning_state = None - self.launch_properties = launch_properties - - -class BuildpackBindingResource(ProxyResource): - """Buildpack Binding Resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProperties - """ - - _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': 'BuildpackBindingProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildpackBindingProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingProperties - """ - super(BuildpackBindingResource, self).__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(msrest.serialization.Model): - """Object that includes an array of BuildpackBinding resources and a possible link for next set. - - :ivar value: Collection of BuildpackBinding resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildpackBindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildpackBindingResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(msrest.serialization.Model): - """Buildpack properties payload. - - :ivar id: Id of the buildpack. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super(BuildpackProperties, self).__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(msrest.serialization.Model): - """Buildpack group properties of the Builder. - - :ivar name: Buildpack group name. - :vartype name: str - :ivar buildpacks: Buildpacks in the buildpack group. - :vartype buildpacks: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackProperties] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'buildpacks': {'key': 'buildpacks', 'type': '[BuildpackProperties]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - buildpacks: Optional[List["BuildpackProperties"]] = None, - **kwargs - ): - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackProperties] - """ - super(BuildpacksGroupProperties, self).__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(msrest.serialization.Model): - """Build resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar relative_path: The relative path of source code. - :vartype relative_path: str - :ivar builder: The resource id of builder to build the source code. - :vartype builder: str - :ivar agent_pool: The resource id of agent pool. - :vartype agent_pool: str - :ivar provisioning_state: Provisioning state of the KPack build result. Possible values - include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2022_04_01.models.TriggeredBuildResult - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'triggered_build_result': {'readonly': True}, - } - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'builder': {'key': 'builder', 'type': 'str'}, - 'agent_pool': {'key': 'agentPool', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'env': {'key': 'env', 'type': '{str}'}, - 'triggered_build_result': {'key': 'triggeredBuildResult', 'type': 'TriggeredBuildResult'}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword relative_path: The relative path of source code. - :paramtype relative_path: str - :keyword builder: The resource id of builder to build the source code. - :paramtype builder: str - :keyword agent_pool: The resource id of agent pool. - :paramtype agent_pool: str - :keyword env: The environment variables for this build. - :paramtype env: dict[str, str] - """ - super(BuildProperties, self).__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.triggered_build_result = None - - -class BuildResult(ProxyResource): - """Build result resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultProperties - """ - - _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': 'BuildResultProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildResultProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultProperties - """ - super(BuildResult, self).__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(msrest.serialization.Model): - """Object that includes an array of Build result resources and a possible link for next set. - - :ivar value: Collection of Build result resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildResult] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildResult"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildResult] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildResultCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(msrest.serialization.Model): - """Build result log resource properties payload. - - :ivar blob_url: The public download URL of this build result log. - :vartype blob_url: str - """ - - _attribute_map = { - 'blob_url': {'key': 'blobUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - blob_url: Optional[str] = None, - **kwargs - ): - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super(BuildResultLog, self).__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(msrest.serialization.Model): - """Build result resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of this build result. - :vartype name: str - :ivar provisioning_state: Provisioning state of the KPack build result. Possible values - include: "Queuing", "Building", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultProvisioningState - :ivar build_pod_name: The build pod name which can be used to get the build log streaming. - :vartype build_pod_name: str - :ivar build_stages: All of the build stage (init-container and container) resources in build - pod. - :vartype build_stages: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildStageProperties] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'build_stages': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'build_pod_name': {'key': 'buildPodName', 'type': 'str'}, - 'build_stages': {'key': 'buildStages', 'type': '[BuildStageProperties]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - build_pod_name: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super(BuildResultProperties, self).__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(msrest.serialization.Model): - """Source information for a deployment. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BuildResultUserSourceInfo, UploadedUserSourceInfo. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'BuildResult': 'BuildResultUserSourceInfo', 'UploadedUserSourceInfo': 'UploadedUserSourceInfo'} - } - - def __init__( - self, - *, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super(UserSourceInfo, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring - instance. - :vartype build_result_id: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'build_result_id': {'key': 'buildResultId', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - build_result_id: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword build_result_id: Resource id of an existing succeeded build result under the same - Spring instance. - :paramtype build_result_id: str - """ - super(BuildResultUserSourceInfo, self).__init__(version=version, **kwargs) - self.type = 'BuildResult' # type: str - self.build_result_id = build_result_id - - -class BuildService(ProxyResource): - """Build service resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProperties - """ - - _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': 'BuildServiceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildServiceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProperties - """ - super(BuildService, self).__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(msrest.serialization.Model): - """Build service agent pool properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the build service agent pool. - :vartype provisioning_state: str - :ivar pool_size: build service agent pool size properties. - :vartype pool_size: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolSizeProperties - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'pool_size': {'key': 'poolSize', 'type': 'BuildServiceAgentPoolSizeProperties'}, - } - - def __init__( - self, - *, - pool_size: Optional["BuildServiceAgentPoolSizeProperties"] = None, - **kwargs - ): - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolSizeProperties - """ - super(BuildServiceAgentPoolProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.pool_size = pool_size - - -class BuildServiceAgentPoolResource(ProxyResource): - """The build service agent pool 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolProperties - """ - - _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': 'BuildServiceAgentPoolProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildServiceAgentPoolProperties"] = None, - **kwargs - ): - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolProperties - """ - super(BuildServiceAgentPoolResource, self).__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(msrest.serialization.Model): - """Object that includes an array of build service agent pool resources and a possible link for next set. - - :ivar value: Collection of build service agent pool resource. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildServiceAgentPoolResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildServiceAgentPoolResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(msrest.serialization.Model): - """Build service agent pool size properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of build service agent pool size. - :vartype name: str - :ivar cpu: The cpu property of build service agent pool size. - :vartype cpu: str - :ivar memory: The memory property of build service agent pool size. - :vartype memory: str - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super(BuildServiceAgentPoolSizeProperties, self).__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(msrest.serialization.Model): - """Object that includes an array of Build service resources and a possible link for next set. - - :ivar value: Collection of Build service resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildService] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildService]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildService"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.BuildService] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildServiceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(msrest.serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar k_pack_version: The installed KPack version in this build service. - :vartype k_pack_version: str - :ivar provisioning_state: Provisioning state of the KPack build result. Possible values - include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'k_pack_version': {'key': 'kPackVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'BuildServicePropertiesResourceRequests'}, - } - - def __init__( - self, - *, - k_pack_version: Optional[str] = None, - resource_requests: Optional["BuildServicePropertiesResourceRequests"] = None, - **kwargs - ): - """ - :keyword k_pack_version: The installed KPack version in this build service. - :paramtype k_pack_version: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServicePropertiesResourceRequests - """ - super(BuildServiceProperties, self).__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(msrest.serialization.Model): - """The runtime resource configuration of this build service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: vCPU allocated to the entire build service node pool. - :vartype cpu: str - :ivar memory: Memory allocated to the entire build service node pool. - :vartype memory: str - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(BuildServicePropertiesResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(msrest.serialization.Model): - """The build stage (init-container and container) resources in build pod. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of this build stage resource. - :vartype name: str - :ivar status: The provisioning state of this build stage resource. Possible values include: - "NotStarted", "Running", "Succeeded", "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_04_01.models.KPackBuildStageProvisioningState - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(BuildStageProperties, self).__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(msrest.serialization.Model): - """Certificate resource payload. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ContentCertificateProperties, KeyVaultCertificateProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar issuer: The issuer of certificate. - :vartype issuer: str - :ivar issued_date: The issue date of certificate. - :vartype issued_date: str - :ivar expiration_date: The expiration date of certificate. - :vartype expiration_date: str - :ivar activate_date: The activate date of certificate. - :vartype activate_date: str - :ivar subject_name: The subject name of certificate. - :vartype subject_name: str - :ivar dns_names: The domain list of certificate. - :vartype dns_names: list[str] - """ - - _validation = { - 'type': {'required': True}, - 'thumbprint': {'readonly': True}, - 'issuer': {'readonly': True}, - 'issued_date': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'activate_date': {'readonly': True}, - 'subject_name': {'readonly': True}, - 'dns_names': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'issued_date': {'key': 'issuedDate', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'activate_date': {'key': 'activateDate', 'type': 'str'}, - 'subject_name': {'key': 'subjectName', 'type': 'str'}, - 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, - } - - _subtype_map = { - 'type': {'ContentCertificate': 'ContentCertificateProperties', 'KeyVaultCertificate': 'KeyVaultCertificateProperties'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.thumbprint = None - self.issuer = None - self.issued_date = None - self.expiration_date = None - self.activate_date = None - self.subject_name = None - self.dns_names = None - - -class CertificateResource(ProxyResource): - """Certificate resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateProperties - """ - - _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': 'CertificateProperties'}, - } - - def __init__( - self, - *, - properties: Optional["CertificateProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateProperties - """ - super(CertificateResource, self).__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(msrest.serialization.Model): - """Collection compose of certificate resources list and a possible link for next page. - - :ivar value: The certificate resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :ivar next_link: The link to next page of certificate list. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super(CertificateResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.appplatform.v2022_04_01.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, - **kwargs - ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.appplatform.v2022_04_01.models.CloudErrorBody] - """ - super(CloudErrorBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(msrest.serialization.Model): - """Service properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the Service. Possible values include: - "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", - "Moving", "Moved", "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfile - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. - :vartype service_id: str - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'service_id': {'readonly': True}, - 'fqdn': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfile'}, - 'version': {'key': 'version', 'type': 'int'}, - 'service_id': {'key': 'serviceId', 'type': 'str'}, - 'zone_redundant': {'key': 'zoneRedundant', 'type': 'bool'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - } - - def __init__( - self, - *, - network_profile: Optional["NetworkProfile"] = None, - zone_redundant: Optional[bool] = False, - **kwargs - ): - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfile - :keyword zone_redundant: - :paramtype zone_redundant: bool - """ - super(ClusterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.version = None - self.service_id = None - self.zone_redundant = zone_redundant - self.fqdn = None - - -class ConfigServerGitProperty(msrest.serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to Azure. - - :ivar repositories: Repositories of git. - :vartype repositories: list[~azure.mgmt.appplatform.v2022_04_01.models.GitPatternRepository] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool - """ - - _validation = { - 'uri': {'required': True}, - } - - _attribute_map = { - 'repositories': {'key': 'repositories', 'type': '[GitPatternRepository]'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'host_key': {'key': 'hostKey', 'type': 'str'}, - 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, - } - - def __init__( - self, - *, - uri: str, - repositories: Optional[List["GitPatternRepository"]] = None, - label: Optional[str] = None, - search_paths: Optional[List[str]] = None, - username: Optional[str] = None, - password: Optional[str] = None, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - strict_host_key_checking: Optional[bool] = None, - **kwargs - ): - """ - :keyword repositories: Repositories of git. - :paramtype repositories: list[~azure.mgmt.appplatform.v2022_04_01.models.GitPatternRepository] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ - super(ConfigServerGitProperty, self).__init__(**kwargs) - self.repositories = repositories - self.uri = uri - self.label = label - self.search_paths = search_paths - self.username = username - self.password = password - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - self.strict_host_key_checking = strict_host_key_checking - - -class ConfigServerProperties(msrest.serialization.Model): - """Config server git properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", - "Deleted", "Failed", "Succeeded", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, - } - - def __init__( - self, - *, - error: Optional["Error"] = None, - config_server: Optional["ConfigServerSettings"] = None, - **kwargs - ): - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - """ - super(ConfigServerProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.config_server = config_server - - -class ConfigServerResource(ProxyResource): - """Config Server 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerProperties - """ - - _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': 'ConfigServerProperties'}, - } - - def __init__( - self, - *, - properties: Optional["ConfigServerProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerProperties - """ - super(ConfigServerResource, self).__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(msrest.serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerGitProperty - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, - } - - def __init__( - self, - *, - git_property: Optional["ConfigServerGitProperty"] = None, - **kwargs - ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerGitProperty - """ - super(ConfigServerSettings, self).__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(msrest.serialization.Model): - """Error record of the config server settings. - - :ivar name: The name of the config server settings error record. - :vartype name: str - :ivar uri: The uri of the config server settings error record. - :vartype uri: str - :ivar messages: The detail error messages of the record. - :vartype messages: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'messages': {'key': 'messages', 'type': '[str]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - uri: Optional[str] = None, - messages: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword name: The name of the config server settings error record. - :paramtype name: str - :keyword uri: The uri of the config server settings error record. - :paramtype uri: str - :keyword messages: The detail error messages of the record. - :paramtype messages: list[str] - """ - super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(msrest.serialization.Model): - """Validation result for config server settings. - - :ivar is_valid: Indicate if the config server settings are valid. - :vartype is_valid: bool - :ivar details: The detail validation results. - :vartype details: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsErrorRecord] - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, - } - - def __init__( - self, - *, - is_valid: Optional[bool] = None, - details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, - **kwargs - ): - """ - :keyword is_valid: Indicate if the config server settings are valid. - :paramtype is_valid: bool - :keyword details: The detail validation results. - :paramtype details: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsErrorRecord] - """ - super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(msrest.serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - 'repositories': {'key': 'repositories', 'type': '[ConfigurationServiceGitRepository]'}, - } - - def __init__( - self, - *, - repositories: Optional[List["ConfigurationServiceGitRepository"]] = None, - **kwargs - ): - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitRepository] - """ - super(ConfigurationServiceGitProperty, self).__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(msrest.serialization.Model): - """Validation result for configuration service settings. - - :ivar is_valid: Indicate if the configuration service settings are valid. - :vartype is_valid: bool - :ivar git_repos_validation_result: The detail validation results. - :vartype git_repos_validation_result: - list[~azure.mgmt.appplatform.v2022_04_01.models.ValidationMessages] - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'git_repos_validation_result': {'key': 'gitReposValidationResult', 'type': '[ValidationMessages]'}, - } - - def __init__( - self, - *, - is_valid: Optional[bool] = None, - git_repos_validation_result: Optional[List["ValidationMessages"]] = None, - **kwargs - ): - """ - :keyword is_valid: Indicate if the configuration service settings are valid. - :paramtype is_valid: bool - :keyword git_repos_validation_result: The detail validation results. - :paramtype git_repos_validation_result: - list[~azure.mgmt.appplatform.v2022_04_01.models.ValidationMessages] - """ - super(ConfigurationServiceGitPropertyValidateResult, self).__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(msrest.serialization.Model): - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar patterns: Required. Collection of patterns of the repository. - :vartype patterns: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Required. Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool - """ - - _validation = { - 'name': {'required': True}, - 'patterns': {'required': True}, - 'uri': {'required': True}, - 'label': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'patterns': {'key': 'patterns', 'type': '[str]'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'host_key': {'key': 'hostKey', 'type': 'str'}, - 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, - } - - def __init__( - self, - *, - name: str, - patterns: List[str], - uri: str, - label: str, - search_paths: Optional[List[str]] = None, - username: Optional[str] = None, - password: Optional[str] = None, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - strict_host_key_checking: Optional[bool] = None, - **kwargs - ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword patterns: Required. Collection of patterns of the repository. - :paramtype patterns: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Required. Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ - super(ConfigurationServiceGitRepository, self).__init__(**kwargs) - self.name = name - self.patterns = patterns - self.uri = uri - self.label = label - self.search_paths = search_paths - self.username = username - self.password = password - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - self.strict_host_key_checking = strict_host_key_checking - - -class ConfigurationServiceInstance(msrest.serialization.Model): - """Collection of instances belong to the Application Configuration Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Configuration Service instance. - :vartype name: str - :ivar status: Status of the Application Configuration Service instance. - :vartype status: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ConfigurationServiceInstance, self).__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(msrest.serialization.Model): - """Application Configuration Service properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Configuration Service. Possible values - include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'resource_requests': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'ConfigurationServiceResourceRequests'}, - 'instances': {'key': 'instances', 'type': '[ConfigurationServiceInstance]'}, - 'settings': {'key': 'settings', 'type': 'ConfigurationServiceSettings'}, - } - - def __init__( - self, - *, - settings: Optional["ConfigurationServiceSettings"] = None, - **kwargs - ): - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings - """ - super(ConfigurationServiceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.resource_requests = None - self.instances = None - self.settings = settings - - -class ConfigurationServiceResource(ProxyResource): - """Application Configuration Service 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProperties - """ - - _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': 'ConfigurationServiceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["ConfigurationServiceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceProperties - """ - super(ConfigurationServiceResource, self).__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(msrest.serialization.Model): - """Object that includes an array of configuration service resources and a possible link for next set. - - :ivar value: Collection of configuration service resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ConfigurationServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of configuration service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ConfigurationServiceResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(msrest.serialization.Model): - """Resource request payload of Application Configuration Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each Application Configuration Service instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Application Configuration Service instance. - :vartype memory: str - :ivar instance_count: Instance count of the Application Configuration Service. - :vartype instance_count: int - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - 'instance_count': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ConfigurationServiceResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(msrest.serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigurationServiceGitProperty'}, - } - - def __init__( - self, - *, - git_property: Optional["ConfigurationServiceGitProperty"] = None, - **kwargs - ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitProperty - """ - super(ConfigurationServiceSettings, self).__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(msrest.serialization.Model): - """Validation result for configuration service settings. - - :ivar git_property_validation_result: Validation result for configuration service settings. - :vartype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - 'git_property_validation_result': {'key': 'gitPropertyValidationResult', 'type': 'ConfigurationServiceGitPropertyValidateResult'}, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs - ): - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceGitPropertyValidateResult - """ - super(ConfigurationServiceSettingsValidateResult, self).__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContentCertificateProperties(CertificateProperties): - """Properties of certificate imported from key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar issuer: The issuer of certificate. - :vartype issuer: str - :ivar issued_date: The issue date of certificate. - :vartype issued_date: str - :ivar expiration_date: The expiration date of certificate. - :vartype expiration_date: str - :ivar activate_date: The activate date of certificate. - :vartype activate_date: str - :ivar subject_name: The subject name of certificate. - :vartype subject_name: str - :ivar dns_names: The domain list of certificate. - :vartype dns_names: list[str] - :ivar content: The content of uploaded certificate. - :vartype content: str - """ - - _validation = { - 'type': {'required': True}, - 'thumbprint': {'readonly': True}, - 'issuer': {'readonly': True}, - 'issued_date': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'activate_date': {'readonly': True}, - 'subject_name': {'readonly': True}, - 'dns_names': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'issued_date': {'key': 'issuedDate', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'activate_date': {'key': 'activateDate', 'type': 'str'}, - 'subject_name': {'key': 'subjectName', 'type': 'str'}, - 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, - 'content': {'key': 'content', 'type': 'str'}, - } - - def __init__( - self, - *, - content: Optional[str] = None, - **kwargs - ): - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super(ContentCertificateProperties, self).__init__(**kwargs) - self.type = 'ContentCertificate' # type: str - self.content = content - - -class CustomDomainProperties(msrest.serialization.Model): - """Custom domain of app resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str - :ivar app_name: The app name of domain. - :vartype app_name: str - :ivar cert_name: The bound certificate name of domain. - :vartype cert_name: str - """ - - _validation = { - 'app_name': {'readonly': True}, - } - - _attribute_map = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'app_name': {'key': 'appName', 'type': 'str'}, - 'cert_name': {'key': 'certName', 'type': 'str'}, - } - - def __init__( - self, - *, - thumbprint: Optional[str] = None, - cert_name: Optional[str] = None, - **kwargs - ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super(CustomDomainProperties, self).__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainProperties - """ - - _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': 'CustomDomainProperties'}, - } - - def __init__( - self, - *, - properties: Optional["CustomDomainProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainProperties - """ - super(CustomDomainResource, self).__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(msrest.serialization.Model): - """Collection compose of a custom domain resources list and a possible link for next page. - - :ivar value: The custom domain resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :ivar next_link: The link to next page of custom domain list. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super(CustomDomainResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(msrest.serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. Name to be validated. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. Name to be validated. - :paramtype name: str - """ - super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(msrest.serialization.Model): - """Validation result for custom domain. - - :ivar is_valid: Indicates if domain name is valid. - :vartype is_valid: bool - :ivar message: Message of why domain name is invalid. - :vartype message: str - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - is_valid: Optional[bool] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword is_valid: Indicates if domain name is valid. - :paramtype is_valid: bool - :keyword message: Message of why domain name is invalid. - :paramtype message: str - """ - super(CustomDomainValidateResult, self).__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class DeploymentInstance(msrest.serialization.Model): - """Deployment instance payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the deployment instance. - :vartype name: str - :ivar status: Status of the deployment instance. - :vartype status: str - :ivar reason: Failed reason of the deployment instance. - :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance. - :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance. - :vartype start_time: str - :ivar zone: Availability zone information of the deployment instance. - :vartype zone: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'reason': {'readonly': True}, - 'discovery_status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'zone': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'zone': {'key': 'zone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeploymentInstance, self).__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentResource(ProxyResource): - """Deployment resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku - """ - - _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': 'DeploymentResourceProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__( - self, - *, - properties: Optional["DeploymentResourceProperties"] = None, - sku: Optional["Sku"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku - """ - super(DeploymentResource, self).__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(msrest.serialization.Model): - """Object that includes an array of App resources and a possible link for next set. - - :ivar value: Collection of Deployment resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeploymentResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(DeploymentResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(msrest.serialization.Model): - """Deployment resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar source: Uploaded source information of the deployment. - :vartype source: ~azure.mgmt.appplatform.v2022_04_01.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: - "Creating", "Updating", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: "Stopped", "Running". - :vartype status: str or ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active. - :vartype active: bool - :ivar instances: Collection of instances belong to the Deployment. - :vartype instances: list[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentInstance] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'UserSourceInfo'}, - 'deployment_settings': {'key': 'deploymentSettings', 'type': 'DeploymentSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'active': {'key': 'active', 'type': 'bool'}, - 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, - } - - def __init__( - self, - *, - source: Optional["UserSourceInfo"] = None, - deployment_settings: Optional["DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs - ): - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_04_01.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super(DeploymentResourceProperties, self).__init__(**kwargs) - self.source = source - self.deployment_settings = deployment_settings - self.provisioning_state = None - self.status = None - self.active = active - self.instances = None - - -class DeploymentSettings(msrest.serialization.Model): - """Deployment settings payload. - - :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :vartype resource_requests: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, dict[str, any]] - """ - - _attribute_map = { - 'resource_requests': {'key': 'resourceRequests', 'type': 'ResourceRequests'}, - 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, - 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, - } - - def __init__( - self, - *, - resource_requests: Optional["ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, - **kwargs - ): - """ - :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :paramtype resource_requests: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, dict[str, any]] - """ - super(DeploymentSettings, self).__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - - -class DiagnosticParameters(msrest.serialization.Model): - """Diagnostic parameters of diagnostic operations. - - :ivar app_instance: App instance name. - :vartype app_instance: str - :ivar file_path: Your target file path in your own BYOS. - :vartype file_path: str - :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :vartype duration: str - """ - - _attribute_map = { - 'app_instance': {'key': 'appInstance', 'type': 'str'}, - 'file_path': {'key': 'filePath', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'str'}, - } - - def __init__( - self, - *, - app_instance: Optional[str] = None, - file_path: Optional[str] = None, - duration: Optional[str] = None, - **kwargs - ): - """ - :keyword app_instance: App instance name. - :paramtype app_instance: str - :keyword file_path: Your target file path in your own BYOS. - :paramtype file_path: str - :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :paramtype duration: str - """ - super(DiagnosticParameters, self).__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(msrest.serialization.Model): - """The error code compose of code and message. - - :ivar code: The code of error. - :vartype code: str - :ivar message: The message of error. - :vartype message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super(Error, self).__init__(**kwargs) - self.code = code - self.message = message - - -class GitPatternRepository(msrest.serialization.Model): - """Git repository property payload for config server. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool - """ - - _validation = { - 'name': {'required': True}, - 'uri': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'pattern': {'key': 'pattern', 'type': '[str]'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'host_key': {'key': 'hostKey', 'type': 'str'}, - 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, - } - - def __init__( - self, - *, - name: str, - uri: str, - pattern: Optional[List[str]] = None, - label: Optional[str] = None, - search_paths: Optional[List[str]] = None, - username: Optional[str] = None, - password: Optional[str] = None, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - strict_host_key_checking: Optional[bool] = None, - **kwargs - ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ - super(GitPatternRepository, self).__init__(**kwargs) - self.name = name - self.pattern = pattern - self.uri = uri - self.label = label - self.search_paths = search_paths - self.username = username - self.password = password - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - self.strict_host_key_checking = strict_host_key_checking - - -class UploadedUserSourceInfo(UserSourceInfo): - """Source with uploaded location. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JarUploadedUserSourceInfo, NetCoreZipUploadedUserSourceInfo, SourceUploadedUserSourceInfo. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Jar': 'JarUploadedUserSourceInfo', 'NetCoreZip': 'NetCoreZipUploadedUserSourceInfo', 'Source': 'SourceUploadedUserSourceInfo'} - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - """ - super(UploadedUserSourceInfo, self).__init__(version=version, **kwargs) - self.type = 'UploadedUserSourceInfo' # type: str - self.relative_path = relative_path - - -class JarUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Jar binary for a deployment. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar runtime_version: Runtime version of the Jar file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, - 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - runtime_version: Optional[str] = None, - jvm_options: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword runtime_version: Runtime version of the Jar file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - """ - super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) - self.type = 'Jar' # type: str - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): - """Properties of certificate imported from key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar issuer: The issuer of certificate. - :vartype issuer: str - :ivar issued_date: The issue date of certificate. - :vartype issued_date: str - :ivar expiration_date: The expiration date of certificate. - :vartype expiration_date: str - :ivar activate_date: The activate date of certificate. - :vartype activate_date: str - :ivar subject_name: The subject name of certificate. - :vartype subject_name: str - :ivar dns_names: The domain list of certificate. - :vartype dns_names: list[str] - :ivar vault_uri: Required. The vault uri of user key vault. - :vartype vault_uri: str - :ivar key_vault_cert_name: Required. The certificate name of key vault. - :vartype key_vault_cert_name: str - :ivar cert_version: The certificate version of key vault. - :vartype cert_version: str - :ivar exclude_private_key: Optional. If set to true, it will not import private key from key - vault. - :vartype exclude_private_key: bool - """ - - _validation = { - 'type': {'required': True}, - 'thumbprint': {'readonly': True}, - 'issuer': {'readonly': True}, - 'issued_date': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'activate_date': {'readonly': True}, - 'subject_name': {'readonly': True}, - 'dns_names': {'readonly': True}, - 'vault_uri': {'required': True}, - 'key_vault_cert_name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'issued_date': {'key': 'issuedDate', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'activate_date': {'key': 'activateDate', 'type': 'str'}, - 'subject_name': {'key': 'subjectName', 'type': 'str'}, - 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, - 'cert_version': {'key': 'certVersion', 'type': 'str'}, - 'exclude_private_key': {'key': 'excludePrivateKey', 'type': 'bool'}, - } - - def __init__( - self, - *, - vault_uri: str, - key_vault_cert_name: str, - cert_version: Optional[str] = None, - exclude_private_key: Optional[bool] = False, - **kwargs - ): - """ - :keyword vault_uri: Required. The vault uri of user key vault. - :paramtype vault_uri: str - :keyword key_vault_cert_name: Required. The certificate name of key vault. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - :keyword exclude_private_key: Optional. If set to true, it will not import private key from key - vault. - :paramtype exclude_private_key: bool - """ - super(KeyVaultCertificateProperties, self).__init__(**kwargs) - self.type = 'KeyVaultCertificate' # type: str - self.vault_uri = vault_uri - self.key_vault_cert_name = key_vault_cert_name - self.cert_version = cert_version - self.exclude_private_key = exclude_private_key - - -class LoadedCertificate(msrest.serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Resource Id of loaded certificate. - :vartype resource_id: str - :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust - store, only work for Java runtime. - :vartype load_trust_store: bool - """ - - _validation = { - 'resource_id': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'load_trust_store': {'key': 'loadTrustStore', 'type': 'bool'}, - } - - def __init__( - self, - *, - resource_id: str, - load_trust_store: Optional[bool] = False, - **kwargs - ): - """ - :keyword resource_id: Required. Resource Id of loaded certificate. - :paramtype resource_id: str - :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust - store, only work for Java runtime. - :paramtype load_trust_store: bool - """ - super(LoadedCertificate, self).__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(msrest.serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to Azure. - - :ivar url: Required. URL of the log file. - :vartype url: str - """ - - _validation = { - 'url': {'required': True}, - } - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - *, - url: str, - **kwargs - ): - """ - :keyword url: Required. URL of the log file. - :paramtype url: str - """ - super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = url - - -class LogSpecification(msrest.serialization.Model): - """Specifications of the Log for Azure Monitoring. - - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - blob_duration: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ - super(LogSpecification, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(msrest.serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs - ): - """ - :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - """ - super(ManagedIdentityProperties, self).__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - - -class MetricDimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. - - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :vartype to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - to_be_exported_for_shoebox: Optional[bool] = None, - **kwargs - ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :paramtype to_be_exported_for_shoebox: bool - """ - super(MetricDimension, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. - - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appplatform.v2022_04_01.models.MetricDimension] - :ivar source_mdm_namespace: Name of the MDM namespace. Optional. - :vartype source_mdm_namespace: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - display_description: Optional[str] = None, - unit: Optional[str] = None, - category: Optional[str] = None, - aggregation_type: Optional[str] = None, - supported_aggregation_types: Optional[List[str]] = None, - supported_time_grain_types: Optional[List[str]] = None, - fill_gap_with_zero: Optional[bool] = None, - dimensions: Optional[List["MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appplatform.v2022_04_01.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super(MetricSpecification, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.category = category - self.aggregation_type = aggregation_type - self.supported_aggregation_types = supported_aggregation_types - self.supported_time_grain_types = supported_time_grain_types - self.fill_gap_with_zero = fill_gap_with_zero - self.dimensions = dimensions - self.source_mdm_namespace = source_mdm_namespace - - -class MonitoringSettingProperties(msrest.serialization.Model): - """Monitoring Setting properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Monitoring Setting. Possible values include: - "NotAvailable", "Failed", "Succeeded", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error - :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated - since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate - if monitoringSettings enabled or not. - :vartype trace_enabled: bool - :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or - whitespace include empty will disable monitoringSettings. - :vartype app_insights_instrumentation_key: str - :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :vartype app_insights_sampling_rate: float - :ivar app_insights_agent_versions: Indicates the versions of application insight agent. - :vartype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2022_04_01.models.ApplicationInsightsAgentVersions - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'app_insights_sampling_rate': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'trace_enabled': {'key': 'traceEnabled', 'type': 'bool'}, - 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, - 'app_insights_sampling_rate': {'key': 'appInsightsSamplingRate', 'type': 'float'}, - 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, - } - - def __init__( - self, - *, - error: Optional["Error"] = None, - trace_enabled: Optional[bool] = None, - app_insights_instrumentation_key: Optional[str] = None, - app_insights_sampling_rate: Optional[float] = None, - app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, - **kwargs - ): - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_04_01.models.Error - :keyword trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :paramtype trace_enabled: bool - :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :paramtype app_insights_instrumentation_key: str - :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :paramtype app_insights_sampling_rate: float - :keyword app_insights_agent_versions: Indicates the versions of application insight agent. - :paramtype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2022_04_01.models.ApplicationInsightsAgentVersions - """ - super(MonitoringSettingProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.trace_enabled = trace_enabled - self.app_insights_instrumentation_key = app_insights_instrumentation_key - self.app_insights_sampling_rate = app_insights_sampling_rate - self.app_insights_agent_versions = app_insights_agent_versions - - -class MonitoringSettingResource(ProxyResource): - """Monitoring Setting 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingProperties - """ - - _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': 'MonitoringSettingProperties'}, - } - - def __init__( - self, - *, - properties: Optional["MonitoringSettingProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingProperties - """ - super(MonitoringSettingResource, self).__init__(**kwargs) - self.properties = properties - - -class NameAvailability(msrest.serialization.Model): - """Name availability result payload. - - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: Reason why the name is not available. - :vartype reason: str - :ivar message: Message why the name is not available. - :vartype message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - name_available: Optional[bool] = None, - reason: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword name_available: Indicates whether the name is available. - :paramtype name_available: bool - :keyword reason: Reason why the name is not available. - :paramtype reason: str - :keyword message: Message why the name is not available. - :paramtype message: str - """ - super(NameAvailability, self).__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(msrest.serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the resource to check name availability. - :vartype type: str - :ivar name: Required. Name to be checked. - :vartype name: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - type: str, - name: str, - **kwargs - ): - """ - :keyword type: Required. Type of the resource to check name availability. - :paramtype type: str - :keyword name: Required. Name to be checked. - :paramtype name: str - """ - super(NameAvailabilityParameters, self).__init__(**kwargs) - self.type = type - self.name = name - - -class NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Jar binary for a deployment. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. - :vartype net_core_main_entry_path: str - :ivar runtime_version: Runtime version of the .Net file. - :vartype runtime_version: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - net_core_main_entry_path: Optional[str] = None, - runtime_version: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. - :paramtype net_core_main_entry_path: str - :keyword runtime_version: Runtime version of the .Net file. - :paramtype runtime_version: str - """ - super(NetCoreZipUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) - self.type = 'NetCoreZip' # type: str - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(msrest.serialization.Model): - """Service network profile payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: ~azure.mgmt.appplatform.v2022_04_01.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: list[~azure.mgmt.appplatform.v2022_04_01.models.RequiredTraffic] - """ - - _validation = { - 'outbound_i_ps': {'readonly': True}, - 'required_traffics': {'readonly': True}, - } - - _attribute_map = { - 'service_runtime_subnet_id': {'key': 'serviceRuntimeSubnetId', 'type': 'str'}, - 'app_subnet_id': {'key': 'appSubnetId', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, - 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, - 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, - } - - def __init__( - self, - *, - service_runtime_subnet_id: Optional[str] = None, - app_subnet_id: Optional[str] = None, - service_cidr: Optional[str] = None, - service_runtime_network_resource_group: Optional[str] = None, - app_network_resource_group: Optional[str] = None, - **kwargs - ): - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - """ - super(NetworkProfile, self).__init__(**kwargs) - self.service_runtime_subnet_id = service_runtime_subnet_id - self.app_subnet_id = app_subnet_id - self.service_cidr = service_cidr - self.service_runtime_network_resource_group = service_runtime_network_resource_group - self.app_network_resource_group = app_network_resource_group - self.outbound_i_ps = None - self.required_traffics = None - - -class NetworkProfileOutboundIPs(msrest.serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_i_ps: A list of public IP addresses. - :vartype public_i_ps: list[str] - """ - - _validation = { - 'public_i_ps': {'readonly': True}, - } - - _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(msrest.serialization.Model): - """Operation detail payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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.appplatform.v2022_04_01.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.OperationProperties - """ - - _validation = { - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["OperationProperties"] = None, - **kwargs - ): - """ - :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.appplatform.v2022_04_01.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.OperationProperties - """ - super(OperationDetail, self).__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.action_type = None - self.origin = origin - self.properties = properties - - -class OperationDisplay(msrest.serialization.Model): - """Operation display payload. - - :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 = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - """ - :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(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - *, - service_specification: Optional["ServiceSpecification"] = None, - **kwargs - ): - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_04_01.models.ServiceSpecification - """ - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(msrest.serialization.Model): - """Persistent disk payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: Size of the persistent disk in GB. - :vartype size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB. - :vartype used_in_gb: int - :ivar mount_path: Mount path of the persistent disk. - :vartype mount_path: str - """ - - _validation = { - 'size_in_gb': {'maximum': 50, 'minimum': 0}, - 'used_in_gb': {'readonly': True, 'maximum': 50, 'minimum': 0}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'used_in_gb': {'key': 'usedInGB', 'type': 'int'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - } - - def __init__( - self, - *, - size_in_gb: Optional[int] = None, - mount_path: Optional[str] = None, - **kwargs - ): - """ - :keyword size_in_gb: Size of the persistent disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the persistent disk. - :paramtype mount_path: str - """ - super(PersistentDisk, self).__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class RegenerateTestKeyRequestPayload(msrest.serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to Azure. - - :ivar key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.TestKeyType - """ - - _validation = { - 'key_type': {'required': True}, - } - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - *, - key_type: Union[str, "TestKeyType"], - **kwargs - ): - """ - :keyword key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.TestKeyType - """ - super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(msrest.serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar protocol: The protocol of required traffic. - :vartype protocol: str - :ivar port: The port of required traffic. - :vartype port: int - :ivar ips: The ip list of required traffic. - :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic. - :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values include: "Inbound", - "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_04_01.models.TrafficDirection - """ - - _validation = { - 'protocol': {'readonly': True}, - 'port': {'readonly': True}, - 'ips': {'readonly': True}, - 'fqdns': {'readonly': True}, - 'direction': {'readonly': True}, - } - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'ips': {'key': 'ips', 'type': '[str]'}, - 'fqdns': {'key': 'fqdns', 'type': '[str]'}, - 'direction': {'key': 'direction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RequiredTraffic, self).__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(msrest.serialization.Model): - """Deployment resource request payload. - - :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for - Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :vartype cpu: str - :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, - 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :vartype memory: str - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - *, - cpu: Optional[str] = None, - memory: Optional[str] = None, - **kwargs - ): - """ - :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 - for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :paramtype cpu: str - :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :paramtype memory: str - """ - super(ResourceRequests, self).__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(msrest.serialization.Model): - """Describes an available Azure Spring Apps SKU. - - :ivar resource_type: Gets the type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: Gets the name of SKU. - :vartype name: str - :ivar tier: Gets the tier of SKU. - :vartype tier: str - :ivar capacity: Gets the capacity of SKU. - :vartype capacity: ~azure.mgmt.appplatform.v2022_04_01.models.SkuCapacity - :ivar locations: Gets the set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Gets a list of locations and availability zones in those locations where - the SKU is available. - :vartype location_info: - list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuLocationInfo] - :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :vartype restrictions: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictions] - """ - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, - 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, - } - - def __init__( - self, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["ResourceSkuRestrictions"]] = None, - **kwargs - ): - """ - :keyword resource_type: Gets the type of resource the SKU applies to. - :paramtype resource_type: str - :keyword name: Gets the name of SKU. - :paramtype name: str - :keyword tier: Gets the tier of SKU. - :paramtype tier: str - :keyword capacity: Gets the capacity of SKU. - :paramtype capacity: ~azure.mgmt.appplatform.v2022_04_01.models.SkuCapacity - :keyword locations: Gets the set of locations that the SKU is available. - :paramtype locations: list[str] - :keyword location_info: Gets a list of locations and availability zones in those locations - where the SKU is available. - :paramtype location_info: - list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuLocationInfo] - :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :paramtype restrictions: - list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictions] - """ - super(ResourceSku, self).__init__(**kwargs) - self.resource_type = resource_type - self.name = name - self.tier = tier - self.capacity = capacity - self.locations = locations - self.location_info = location_info - self.restrictions = restrictions - - -class ResourceSkuCapabilities(msrest.serialization.Model): - """ResourceSkuCapabilities. - - :ivar name: Gets an invariant to describe the feature. - :vartype name: str - :ivar value: Gets an invariant if the feature is measured by quantity. - :vartype value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Gets an invariant to describe the feature. - :paramtype name: str - :keyword value: Gets an invariant if the feature is measured by quantity. - :paramtype value: str - """ - super(ResourceSkuCapabilities, self).__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(msrest.serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSku] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ResourceSku"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSku] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ResourceSkuCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """Locations and availability zones where the SKU is available. - - :ivar location: Gets location of the SKU. - :vartype location: str - :ivar zones: Gets list of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. - :vartype zone_details: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuZoneDetails] - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, - **kwargs - ): - """ - :keyword location: Gets location of the SKU. - :paramtype location: str - :keyword zones: Gets list of availability zones where the SKU is supported. - :paramtype zones: list[str] - :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. - :paramtype zone_details: - list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuZoneDetails] - """ - super(ResourceSkuLocationInfo, self).__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(msrest.serialization.Model): - """Information about the restriction where the SKU cannot be used. - - :ivar locations: Gets locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: Gets list of availability zones where the SKU is restricted. - :vartype zones: list[str] - """ - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - *, - locations: Optional[List[str]] = None, - zones: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword locations: Gets locations where the SKU is restricted. - :paramtype locations: list[str] - :keyword zones: Gets list of availability zones where the SKU is restricted. - :paramtype zones: list[str] - """ - super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(msrest.serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :vartype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsType - :ivar values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :vartype restriction_info: - ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsReasonCode - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs - ): - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsType - :keyword values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :paramtype values: list[str] - :keyword restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :paramtype restriction_info: - ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuRestrictionsReasonCode - """ - super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(msrest.serialization.Model): - """Details of capabilities available to a SKU in specific zones. - - :ivar name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :vartype name: list[str] - :ivar capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :vartype capabilities: list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCapabilities] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - *, - name: Optional[List[str]] = None, - capabilities: Optional[List["ResourceSkuCapabilities"]] = None, - **kwargs - ): - """ - :keyword name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :paramtype name: list[str] - :keyword capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :paramtype capabilities: - list[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCapabilities] - """ - super(ResourceSkuZoneDetails, self).__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(msrest.serialization.Model): - """Resource upload definition payload. - - :ivar relative_path: Source relative path. - :vartype relative_path: str - :ivar upload_url: Upload URL. - :vartype upload_url: str - """ - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - upload_url: Optional[str] = None, - **kwargs - ): - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super(ResourceUploadDefinition, self).__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(msrest.serialization.Model): - """Collection of instances belong to the Service Registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Service Registry instance. - :vartype name: str - :ivar status: Status of the Service Registry instance. - :vartype status: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ServiceRegistryInstance, self).__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(msrest.serialization.Model): - """Service Registry properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Service Registry. Possible values include: "Creating", - "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryInstance] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'resource_requests': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'ServiceRegistryResourceRequests'}, - 'instances': {'key': 'instances', 'type': '[ServiceRegistryInstance]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ServiceRegistryProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.resource_requests = None - self.instances = None - - -class ServiceRegistryResource(ProxyResource): - """Service Registry 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProperties - """ - - _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': 'ServiceRegistryProperties'}, - } - - def __init__( - self, - *, - properties: Optional["ServiceRegistryProperties"] = None, - **kwargs - ): - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryProperties - """ - super(ServiceRegistryResource, self).__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(msrest.serialization.Model): - """Object that includes an array of Service Registry resources and a possible link for next set. - - :ivar value: Collection of Service Registry resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceRegistryResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ServiceRegistryResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(msrest.serialization.Model): - """Resource request payload of Service Registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each Service Registry instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Service Registry instance. - :vartype memory: str - :ivar instance_count: Instance count of the Service Registry. - :vartype instance_count: int - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - 'instance_count': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ServiceRegistryResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - """ - super(TrackedResource, self).__init__(**kwargs) - self.location = location - self.tags = tags - - -class ServiceResource(TrackedResource): - """Service 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the Service resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku - """ - - _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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["ClusterResourceProperties"] = None, - sku: Optional["Sku"] = None, - **kwargs - ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the Service resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_04_01.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_04_01.models.Sku - """ - super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(msrest.serialization.Model): - """Object that includes an array of Service resources and a possible link for next set. - - :ivar value: Collection of Service resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ServiceResourceList, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.appplatform.v2022_04_01.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_04_01.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["LogSpecification"]] = None, - metric_specifications: Optional[List["MetricSpecification"]] = None, - **kwargs - ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_04_01.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_04_01.models.MetricSpecification] - """ - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class Sku(msrest.serialization.Model): - """Sku of Azure Spring Apps. - - :ivar name: Name of the Sku. - :vartype name: str - :ivar tier: Tier of the Sku. - :vartype tier: str - :ivar capacity: Current capacity of the target resource. - :vartype capacity: int - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - *, - name: Optional[str] = "S0", - tier: Optional[str] = "Standard", - capacity: Optional[int] = None, - **kwargs - ): - """ - :keyword name: Name of the Sku. - :paramtype name: str - :keyword tier: Tier of the Sku. - :paramtype tier: str - :keyword capacity: Current capacity of the target resource. - :paramtype capacity: int - """ - super(Sku, self).__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(msrest.serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to Azure. - - :ivar minimum: Required. Gets or sets the minimum. - :vartype minimum: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar default: Gets or sets the default. - :vartype default: int - :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.SkuScaleType - """ - - _validation = { - 'minimum': {'required': True}, - } - - _attribute_map = { - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - 'default': {'key': 'default', 'type': 'int'}, - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - } - - def __init__( - self, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "SkuScaleType"]] = None, - **kwargs - ): - """ - :keyword minimum: Required. Gets or sets the minimum. - :paramtype minimum: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword default: Gets or sets the default. - :paramtype default: int - :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.SkuScaleType - """ - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :vartype artifact_selector: str - :ivar runtime_version: Runtime version of the source file. - :vartype runtime_version: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - artifact_selector: Optional[str] = None, - runtime_version: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :paramtype artifact_selector: str - :keyword runtime_version: Runtime version of the source file. - :paramtype runtime_version: str - """ - super(SourceUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) - self.type = 'Source' # type: str - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class StackProperties(msrest.serialization.Model): - """KPack ClusterStack properties payload. - - :ivar id: Id of the ClusterStack. - :vartype id: str - :ivar version: Version of the ClusterStack. - :vartype version: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super(StackProperties, self).__init__(**kwargs) - self.id = id - self.version = version - - -class SupportedBuildpackResource(ProxyResource): - """Supported buildpack resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResourceProperties - """ - - _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': 'SupportedBuildpackResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["SupportedBuildpackResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResourceProperties - """ - super(SupportedBuildpackResource, self).__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(msrest.serialization.Model): - """Supported buildpack resource properties. - - :ivar buildpack_id: The id of supported buildpack. - :vartype buildpack_id: str - """ - - _attribute_map = { - 'buildpack_id': {'key': 'buildpackId', 'type': 'str'}, - } - - def __init__( - self, - *, - buildpack_id: Optional[str] = None, - **kwargs - ): - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super(SupportedBuildpackResourceProperties, self).__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(msrest.serialization.Model): - """Object that includes an array of supported buildpacks resources and a possible link for next set. - - :ivar value: Collection of supported buildpacks resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SupportedBuildpackResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(SupportedBuildpacksCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(msrest.serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values - include: "Java_8", "Java_11", "Java_17", "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :vartype platform: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimePlatform - :ivar version: The detailed version (major.minor) of the platform. - :vartype version: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'platform': {'key': 'platform', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[Union[str, "SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "Java_17", "NetCore_31". - :paramtype value: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :paramtype platform: str or ~azure.mgmt.appplatform.v2022_04_01.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super(SupportedRuntimeVersion, self).__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SupportedStackResource(ProxyResource): - """Supported stack resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_04_01.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResourceProperties - """ - - _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': 'SupportedStackResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["SupportedStackResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResourceProperties - """ - super(SupportedStackResource, self).__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(msrest.serialization.Model): - """Supported stack resource properties. - - :ivar stack_id: The id of supported stack. - :vartype stack_id: str - :ivar version: The version of supported stack. - :vartype version: str - """ - - _attribute_map = { - 'stack_id': {'key': 'stackId', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - *, - stack_id: Optional[str] = None, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super(SupportedStackResourceProperties, self).__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(msrest.serialization.Model): - """Object that includes an array of supported stacks resources and a possible link for next set. - - :ivar value: Collection of supported stacks resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SupportedStackResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(SupportedStacksCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: - "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_04_01.models.LastModifiedByType - :ivar last_modified_at: The timestamp of resource modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~azure.mgmt.appplatform.v2022_04_01.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_04_01.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super(SystemData, self).__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TemporaryDisk(msrest.serialization.Model): - """Temporary disk payload. - - :ivar size_in_gb: Size of the temporary disk in GB. - :vartype size_in_gb: int - :ivar mount_path: Mount path of the temporary disk. - :vartype mount_path: str - """ - - _validation = { - 'size_in_gb': {'maximum': 5, 'minimum': 0}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - } - - def __init__( - self, - *, - size_in_gb: Optional[int] = None, - mount_path: Optional[str] = "/tmp", - **kwargs - ): - """ - :keyword size_in_gb: Size of the temporary disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the temporary disk. - :paramtype mount_path: str - """ - super(TemporaryDisk, self).__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(msrest.serialization.Model): - """Test keys payload. - - :ivar primary_key: Primary key. - :vartype primary_key: str - :ivar secondary_key: Secondary key. - :vartype secondary_key: str - :ivar primary_test_endpoint: Primary test endpoint. - :vartype primary_test_endpoint: str - :ivar secondary_test_endpoint: Secondary test endpoint. - :vartype secondary_test_endpoint: str - :ivar enabled: Indicates whether the test endpoint feature enabled or not. - :vartype enabled: bool - """ - - _attribute_map = { - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'primary_test_endpoint': {'key': 'primaryTestEndpoint', 'type': 'str'}, - 'secondary_test_endpoint': {'key': 'secondaryTestEndpoint', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - *, - primary_key: Optional[str] = None, - secondary_key: Optional[str] = None, - primary_test_endpoint: Optional[str] = None, - secondary_test_endpoint: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs - ): - """ - :keyword primary_key: Primary key. - :paramtype primary_key: str - :keyword secondary_key: Secondary key. - :paramtype secondary_key: str - :keyword primary_test_endpoint: Primary test endpoint. - :paramtype primary_test_endpoint: str - :keyword secondary_test_endpoint: Secondary test endpoint. - :paramtype secondary_test_endpoint: str - :keyword enabled: Indicates whether the test endpoint feature enabled or not. - :paramtype enabled: bool - """ - super(TestKeys, self).__init__(**kwargs) - self.primary_key = primary_key - self.secondary_key = secondary_key - self.primary_test_endpoint = primary_test_endpoint - self.secondary_test_endpoint = secondary_test_endpoint - self.enabled = enabled - - -class TriggeredBuildResult(msrest.serialization.Model): - """The build result triggered by a build. - - :ivar id: The unique build id of this build result. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super(TriggeredBuildResult, self).__init__(**kwargs) - self.id = id - - -class ValidationMessages(msrest.serialization.Model): - """Validate messages of the configuration service git repositories. - - :ivar name: The name of the configuration service git repository. - :vartype name: str - :ivar messages: Detailed validation messages. - :vartype messages: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'messages': {'key': 'messages', 'type': '[str]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - messages: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super(ValidationMessages, self).__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py deleted file mode 100644 index 152a0c3a076..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/__init__.py +++ /dev/null @@ -1,45 +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 ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._build_service_operations import BuildServiceOperations -from ._buildpack_binding_operations import BuildpackBindingOperations -from ._build_service_builder_operations import BuildServiceBuilderOperations -from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations - -__all__ = [ - 'ServicesOperations', - 'ConfigServersOperations', - 'ConfigurationServicesOperations', - 'ServiceRegistriesOperations', - 'BuildServiceOperations', - 'BuildpackBindingOperations', - 'BuildServiceBuilderOperations', - 'BuildServiceAgentPoolOperations', - 'MonitoringSettingsOperations', - 'AppsOperations', - 'BindingsOperations', - 'CertificatesOperations', - 'CustomDomainsOperations', - 'DeploymentsOperations', - 'Operations', - 'RuntimeVersionsOperations', - 'SkusOperations', -] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py deleted file mode 100644 index 8e2678df7da..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_apps_operations.py +++ /dev/null @@ -1,1190 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_active_deployments_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class AppsOperations(object): - """AppsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": - """Get an App and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AppResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: - """Create a new App or update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the create or update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: - """Operation to update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_04_01.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.AppResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AppResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore - - @distributed_trace - def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for an App, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - - request = build_set_active_deployments_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._set_active_deployments_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: - """Set existing Deployment under the app as active. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_04_01.models.ActiveDeploymentCollection - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._set_active_deployments_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - active_deployment_collection=active_deployment_collection, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the resource name is valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py deleted file mode 100644 index d8a5486c764..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_bindings_operations.py +++ /dev/null @@ -1,823 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BindingsOperations(object): - """BindingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": - """Get a Binding and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: - """Create a new Binding or update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: - """Operation to update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.BindingResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 46ed30daead..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,475 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BuildServiceAgentPoolOperations(object): - """BuildServiceAgentPoolOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"]: - """List build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - """Get build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildServiceAgentPoolResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> LROPoller["_models.BuildServiceAgentPoolResource"]: - """Create or update build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceAgentPoolResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - agent_pool_resource=agent_pool_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py deleted file mode 100644 index 47acb0bb488..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,631 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BuildServiceBuilderOperations(object): - """BuildServiceBuilderOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> "_models.BuilderResource": - """Get a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuilderResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> "_models.BuilderResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(builder_resource, 'BuilderResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> LROPoller["_models.BuilderResource"]: - """Create or update a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. - :type builder_resource: ~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - builder_resource=builder_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuilderResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuilderResourceCollection"]: - """List KPack builders result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuilderResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py deleted file mode 100644 index 7b06e603558..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_build_service_operations.py +++ /dev/null @@ -1,1506 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_build_services_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_service_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_builds_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_build_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_build_results_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_result_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_result_log_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_supported_buildpacks_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_supported_buildpack_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_supported_stacks_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_supported_stack_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BuildServiceOperations(object): - """BuildServiceOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_build_services( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildServiceCollection"]: - """List build services resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildServiceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_build_services.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore - - @distributed_trace - def get_build_service( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.BuildService": - """Get a build service resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildService, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildService - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_service_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_build_service.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildService', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore - - - @distributed_trace - def list_builds( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildCollection"]: - """List KPack builds. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_builds.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore - - @distributed_trace - def get_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> "_models.Build": - """Get a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.get_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: "_models.Build", - **kwargs: Any - ) -> "_models.Build": - """Create or update a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build: Parameters for the create or update operation. - :type build: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(build, 'Build') - - request = build_create_or_update_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Build', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace - def list_build_results( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildResultCollection"]: - """List KPack build results. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildResultCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.list_build_results.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildResultCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore - - @distributed_trace - def get_build_result( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResult": - """Get a KPack build result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_result_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore - - - @distributed_trace - def get_build_result_log( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResultLog": - """Get a KPack build result log download URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResultLog, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildResultLog - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_build_result_log_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result_log.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResultLog', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore - - - @distributed_trace - def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for build service, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace - def list_supported_buildpacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpacksCollection": - """Get all supported buildpacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_supported_buildpacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_buildpacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore - - - @distributed_trace - def get_supported_buildpack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpackResource": - """Get the supported buildpack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. - :type buildpack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedBuildpackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_supported_buildpack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - api_version=api_version, - template_url=self.get_supported_buildpack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore - - - @distributed_trace - def list_supported_stacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedStacksCollection": - """Get all supported stacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_supported_stacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_stacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore - - - @distributed_trace - def get_supported_stack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any - ) -> "_models.SupportedStackResource": - """Get the supported stack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param stack_name: The name of the stack resource. - :type stack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.SupportedStackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_supported_stack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - api_version=api_version, - template_url=self.get_supported_stack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py deleted file mode 100644 index e6e495b96e9..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,660 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BuildpackBindingOperations(object): - """BuildpackBindingOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - """Get a buildpack binding by name. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildpackBindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> LROPoller["_models.BuildpackBindingResource"]: - """Create or update a buildpack binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: ~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - buildpack_binding=buildpack_binding, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Buildpack Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResourceCollection"]: - """Handles requests to list all buildpack bindings in a builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.BuildpackBindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py deleted file mode 100644 index dcc60dcc7f5..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_certificates_operations.py +++ /dev/null @@ -1,605 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class CertificatesOperations(object): - """CertificatesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": - """Get the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> LROPoller["_models.CertificateResource"]: - """Create or update certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.CertificateResourceCollection"]: - """List all the certificates of one user. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CertificateResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py deleted file mode 100644 index 6c8346d206a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_config_servers_operations.py +++ /dev/null @@ -1,664 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class ConfigServersOperations(object): - """ConfigServersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": - """Get the config server and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigServerResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: - """Check if the config server settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_settings: Config server settings to be validated. - :type config_server_settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py deleted file mode 100644 index 4445a51fd11..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_configuration_services_operations.py +++ /dev/null @@ -1,785 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class ConfigurationServicesOperations(object): - """ConfigurationServicesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - """Get the Application Configuration Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigurationServiceResource"]: - """Create the default Application Configuration Service or update the existing Application - Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> "_models.ConfigurationServiceSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(settings, 'ConfigurationServiceSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore - - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"]: - """Check if the Application Configuration Service settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. - :type settings: ~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ConfigurationServiceSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - settings=settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py deleted file mode 100644 index 411a7af4d43..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_custom_domains_operations.py +++ /dev/null @@ -1,823 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class CustomDomainsOperations(object): - """CustomDomainsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": - """Get the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: - """Create or update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: - """Update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainResourceCollection"]: - """List the custom domains of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.CustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py deleted file mode 100644 index d9b0bc5e624..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_deployments_operations.py +++ /dev/null @@ -1,2069 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_cluster_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restart_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_log_file_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_generate_heap_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_generate_thread_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_start_jfr_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class DeploymentsOperations(object): # pylint: disable=too-many-public-methods - """DeploymentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": - """Get a Deployment and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: - """Create a new Deployment or update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: - """Operation to update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. - :type deployment_resource: ~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: - """List deployments for a certain service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - - def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Start the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Stop the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - - @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Restart the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - @distributed_trace - def get_log_file_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: - """Get deployment log file URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogFileUrlResponse, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.LogFileUrlResponse or None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - - @distributed_trace - def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: - """Generate Heap Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._generate_heap_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - - @distributed_trace - def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: - """Generate Thread Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._generate_thread_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - def _start_jfr_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore - - - @distributed_trace - def begin_start_jfr( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: - """Start JFR. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: ~azure.mgmt.appplatform.v2022_04_01.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_jfr_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py deleted file mode 100644 index ed3089493c2..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,493 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class MonitoringSettingsOperations(object): - """MonitoringSettingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - """Get the Monitoring Setting and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MonitoringSettingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py deleted file mode 100644 index 8aa9a994c27..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_operations.py +++ /dev/null @@ -1,144 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.AvailableOperations] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py deleted file mode 100644 index 4295dc5119c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_runtime_versions_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RuntimeVersionsOperations(object): - """RuntimeVersionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_runtime_versions( - self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailableRuntimeVersions, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.AvailableRuntimeVersions - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py deleted file mode 100644 index 6f1001b7b9c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_service_registries_operations.py +++ /dev/null @@ -1,582 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ServiceRegistriesOperations(object): - """ServiceRegistriesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - """Get the Service Registry and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceRegistryResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> LROPoller["_models.ServiceRegistryResource"]: - """Create the default Service Registry or update the existing Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceRegistryResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py deleted file mode 100644 index 99a8f74e7b2..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_services_operations.py +++ /dev/null @@ -1,1348 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_test_keys_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_test_key_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_disable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_enable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ServicesOperations(object): - """ServicesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": - """Get a Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: - """Create a new Service or update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the create or update operation. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: - """Operation to update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the update operation. - :type resource: ~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace - def list_test_keys( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """List test keys for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": - """Regenerate a test key for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_04_01.models.RegenerateTestKeyRequestPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - """Disable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - - - @distributed_trace - def enable_test_endpoint( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """Enable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": - """Checks that the resource name is valid and is not already in use. - - :param location: the region. - :type location: str - :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailabilityParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailability, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_04_01.models.NameAvailability - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NameAvailability', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a resource group. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py deleted file mode 100644 index 4b65de70e55..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_04_01/operations/_skus_operations.py +++ /dev/null @@ -1,153 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class SkusOperations(object): - """SkusOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_04_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.ResourceSkuCollection"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_04_01.models.ResourceSkuCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-04-01") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore From 87d4d666b004f70c90875b1982d22c3231d9d240 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Wed, 18 May 2022 16:59:40 +0800 Subject: [PATCH 04/21] fix --- src/spring/azext_spring/_buildservices_factory.py | 6 ++---- src/spring/azext_spring/_client_factory.py | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spring/azext_spring/_buildservices_factory.py b/src/spring/azext_spring/_buildservices_factory.py index ab10446868f..7e62bd50837 100644 --- a/src/spring/azext_spring/_buildservices_factory.py +++ b/src/spring/azext_spring/_buildservices_factory.py @@ -63,15 +63,13 @@ def _queue_build(self, relative_path=None, builder=None, build_env=None, build_c service_resource_id = '/subscriptions/{}/resourceGroups/{}/providers/Microsoft.AppPlatform/Spring/{}'.format(subscription, self.resource_group, self.service) build_resource_requests = models.BuildResourceRequests( cpu=build_cpu, - memory=build_memory - ) + memory=build_memory) properties = models.BuildProperties( builder='{}/buildservices/default/builders/{}'.format(service_resource_id, builder), agent_pool='{}/buildservices/default/agentPools/default'.format(service_resource_id), relative_path=relative_path, env=build_env if build_env else None, - resource_requests=build_resource_requests - ) + resource_requests=build_resource_requests) build = models.Build(properties=properties) try: return self.client.build_service.create_or_update_build(self.resource_group, diff --git a/src/spring/azext_spring/_client_factory.py b/src/spring/azext_spring/_client_factory.py index 1cb282287b0..8f58ca34d9b 100644 --- a/src/spring/azext_spring/_client_factory.py +++ b/src/spring/azext_spring/_client_factory.py @@ -24,9 +24,11 @@ AppPlatformManagementClient as AppPlatformManagementClient_20210901preview ) + def cf_spring_20220501preview(cli_ctx, *_): return get_mgmt_service_client(cli_ctx, AppPlatformManagementClient_20220501preview) + def cf_spring_20220301preview(cli_ctx, *_): return get_mgmt_service_client(cli_ctx, AppPlatformManagementClient_20220301preview) From b37430ddce060103131c120dd9b3f85ea4fb98ff Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Thu, 19 May 2022 10:23:56 +0800 Subject: [PATCH 05/21] update sdk --- .../v2022_05_01_preview/__init__.py | 18 - .../_app_platform_management_client.py | 180 - .../v2022_05_01_preview/_configuration.py | 74 - .../appplatform/v2022_05_01_preview/_patch.py | 31 - .../v2022_05_01_preview/_vendor.py | 27 - .../v2022_05_01_preview/_version.py | 9 - .../v2022_05_01_preview/aio/__init__.py | 15 - .../aio/_app_platform_management_client.py | 177 - .../v2022_05_01_preview/aio/_configuration.py | 73 - .../v2022_05_01_preview/aio/_patch.py | 31 - .../aio/operations/__init__.py | 57 - .../_api_portal_custom_domains_operations.py | 464 - .../aio/operations/_api_portals_operations.py | 512 -- .../aio/operations/_apps_operations.py | 853 -- .../aio/operations/_bindings_operations.py | 606 -- .../_build_service_agent_pool_operations.py | 346 - .../_build_service_builder_operations.py | 462 - .../operations/_build_service_operations.py | 985 -- .../_buildpack_binding_operations.py | 484 - .../operations/_certificates_operations.py | 445 - .../operations/_config_servers_operations.py | 495 - .../_configuration_services_operations.py | 578 -- .../operations/_custom_domains_operations.py | 606 -- .../aio/operations/_deployments_operations.py | 1509 --- .../_gateway_custom_domains_operations.py | 464 - .../_gateway_route_configs_operations.py | 465 - .../aio/operations/_gateways_operations.py | 512 -- .../_monitoring_settings_operations.py | 365 - .../aio/operations/_operations.py | 115 - .../_runtime_versions_operations.py | 93 - .../_service_registries_operations.py | 430 - .../aio/operations/_services_operations.py | 1135 --- .../aio/operations/_skus_operations.py | 118 - .../aio/operations/_storages_operations.py | 444 - .../v2022_05_01_preview/models/__init__.py | 441 - .../_app_platform_management_client_enums.py | 329 - .../v2022_05_01_preview/models/_models_py3.py | 8111 ----------------- .../operations/__init__.py | 57 - .../_api_portal_custom_domains_operations.py | 633 -- .../operations/_api_portals_operations.py | 719 -- .../operations/_apps_operations.py | 1194 --- .../operations/_bindings_operations.py | 823 -- .../_build_service_agent_pool_operations.py | 475 - .../_build_service_builder_operations.py | 631 -- .../operations/_build_service_operations.py | 1506 --- .../_buildpack_binding_operations.py | 661 -- .../operations/_certificates_operations.py | 606 -- .../operations/_config_servers_operations.py | 667 -- .../_configuration_services_operations.py | 785 -- .../operations/_custom_domains_operations.py | 823 -- .../operations/_deployments_operations.py | 2074 ----- .../_gateway_custom_domains_operations.py | 633 -- .../_gateway_route_configs_operations.py | 634 -- .../operations/_gateways_operations.py | 719 -- .../_monitoring_settings_operations.py | 493 - .../operations/_operations.py | 144 - .../_runtime_versions_operations.py | 122 - .../_service_registries_operations.py | 582 -- .../operations/_services_operations.py | 1630 ---- .../operations/_skus_operations.py | 153 - .../operations/_storages_operations.py | 605 -- 61 files changed, 39428 deletions(-) delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py delete mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py deleted file mode 100644 index 41ec6d71ff7..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/__init__.py +++ /dev/null @@ -1,18 +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 ._app_platform_management_client import AppPlatformManagementClient -from ._version import VERSION - -__version__ = VERSION -__all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py deleted file mode 100644 index 68cee389f37..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_app_platform_management_client.py +++ /dev/null @@ -1,180 +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 copy import deepcopy -from typing import Any, TYPE_CHECKING - -from msrest import Deserializer, Serializer - -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient - -from . import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_05_01_preview.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_05_01_preview.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_05_01_preview.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_05_01_preview.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_05_01_preview.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_05_01_preview.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_05_01_preview.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_05_01_preview.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_05_01_preview.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_05_01_preview.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_05_01_preview.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - def close(self): - # type: () -> None - self._client.close() - - def __enter__(self): - # type: () -> AppPlatformManagementClient - self._client.__enter__() - return self - - def __exit__(self, *exc_details): - # type: (Any) -> None - self._client.__exit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py deleted file mode 100644 index e8e7fc80c5d..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_configuration.py +++ /dev/null @@ -1,74 +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, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AppPlatformManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs # type: Any - ): - # type: (...) -> None - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py deleted file mode 100644 index 138f663c53a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_vendor.py +++ /dev/null @@ -1,27 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [ - c for c in formatted_components if "{}".format(key.args[0]) not in c - ] - template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py deleted file mode 100644 index 92453d8691d..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "6.1.0" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py deleted file mode 100644 index 44ce4a5043f..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/__init__.py +++ /dev/null @@ -1,15 +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 ._app_platform_management_client import AppPlatformManagementClient -__all__ = ['AppPlatformManagementClient'] - -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py deleted file mode 100644 index 9df90c90928..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_app_platform_management_client.py +++ /dev/null @@ -1,177 +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 copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING - -from msrest import Deserializer, Serializer - -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient - -from .. import models -from ._configuration import AppPlatformManagementClientConfiguration -from .operations import ApiPortalCustomDomainsOperations, ApiPortalsOperations, AppsOperations, BindingsOperations, BuildServiceAgentPoolOperations, BuildServiceBuilderOperations, BuildServiceOperations, BuildpackBindingOperations, CertificatesOperations, ConfigServersOperations, ConfigurationServicesOperations, CustomDomainsOperations, DeploymentsOperations, GatewayCustomDomainsOperations, GatewayRouteConfigsOperations, GatewaysOperations, MonitoringSettingsOperations, Operations, RuntimeVersionsOperations, ServiceRegistriesOperations, ServicesOperations, SkusOperations, StoragesOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -class AppPlatformManagementClient: # pylint: disable=too-many-instance-attributes - """REST API for Azure Spring Apps. - - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServicesOperations - :ivar config_servers: ConfigServersOperations operations - :vartype config_servers: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ConfigServersOperations - :ivar configuration_services: ConfigurationServicesOperations operations - :vartype configuration_services: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ConfigurationServicesOperations - :ivar service_registries: ServiceRegistriesOperations operations - :vartype service_registries: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ServiceRegistriesOperations - :ivar build_service: BuildServiceOperations operations - :vartype build_service: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceOperations - :ivar buildpack_binding: BuildpackBindingOperations operations - :vartype buildpack_binding: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildpackBindingOperations - :ivar build_service_builder: BuildServiceBuilderOperations operations - :vartype build_service_builder: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceBuilderOperations - :ivar build_service_agent_pool: BuildServiceAgentPoolOperations operations - :vartype build_service_agent_pool: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BuildServiceAgentPoolOperations - :ivar monitoring_settings: MonitoringSettingsOperations operations - :vartype monitoring_settings: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.MonitoringSettingsOperations - :ivar apps: AppsOperations operations - :vartype apps: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.AppsOperations - :ivar bindings: BindingsOperations operations - :vartype bindings: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.BindingsOperations - :ivar storages: StoragesOperations operations - :vartype storages: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.StoragesOperations - :ivar certificates: CertificatesOperations operations - :vartype certificates: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.CertificatesOperations - :ivar custom_domains: CustomDomainsOperations operations - :vartype custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.CustomDomainsOperations - :ivar deployments: DeploymentsOperations operations - :vartype deployments: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.DeploymentsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.Operations - :ivar runtime_versions: RuntimeVersionsOperations operations - :vartype runtime_versions: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.RuntimeVersionsOperations - :ivar skus: SkusOperations operations - :vartype skus: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.SkusOperations - :ivar gateways: GatewaysOperations operations - :vartype gateways: azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewaysOperations - :ivar gateway_route_configs: GatewayRouteConfigsOperations operations - :vartype gateway_route_configs: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewayRouteConfigsOperations - :ivar gateway_custom_domains: GatewayCustomDomainsOperations operations - :vartype gateway_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.GatewayCustomDomainsOperations - :ivar api_portals: ApiPortalsOperations operations - :vartype api_portals: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ApiPortalsOperations - :ivar api_portal_custom_domains: ApiPortalCustomDomainsOperations operations - :vartype api_portal_custom_domains: - azure.mgmt.appplatform.v2022_05_01_preview.aio.operations.ApiPortalCustomDomainsOperations - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = AppPlatformManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.config_servers = ConfigServersOperations(self._client, self._config, self._serialize, self._deserialize) - self.configuration_services = ConfigurationServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.service_registries = ServiceRegistriesOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service = BuildServiceOperations(self._client, self._config, self._serialize, self._deserialize) - self.buildpack_binding = BuildpackBindingOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_builder = BuildServiceBuilderOperations(self._client, self._config, self._serialize, self._deserialize) - self.build_service_agent_pool = BuildServiceAgentPoolOperations(self._client, self._config, self._serialize, self._deserialize) - self.monitoring_settings = MonitoringSettingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.apps = AppsOperations(self._client, self._config, self._serialize, self._deserialize) - self.bindings = BindingsOperations(self._client, self._config, self._serialize, self._deserialize) - self.storages = StoragesOperations(self._client, self._config, self._serialize, self._deserialize) - self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) - self.custom_domains = CustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.runtime_versions = RuntimeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.skus = SkusOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_route_configs = GatewayRouteConfigsOperations(self._client, self._config, self._serialize, self._deserialize) - self.gateway_custom_domains = GatewayCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portals = ApiPortalsOperations(self._client, self._config, self._serialize, self._deserialize) - self.api_portal_custom_domains = ApiPortalCustomDomainsOperations(self._client, self._config, self._serialize, self._deserialize) - - - def _send_request( - self, - request: HttpRequest, - **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "AppPlatformManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py deleted file mode 100644 index ecc6689ee8b..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_configuration.py +++ /dev/null @@ -1,73 +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, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class AppPlatformManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes - """Configuration for AppPlatformManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :param credential: Credential needed for the client to connect to Azure. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription ID which uniquely identify the Microsoft Azure - subscription. The subscription ID forms part of the URI for every service call. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-05-01-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - super(AppPlatformManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'mgmt-appplatform/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) - self.authentication_policy = kwargs.get('authentication_policy') - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py deleted file mode 100644 index 74e48ecd07c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/_patch.py +++ /dev/null @@ -1,31 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# -# Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# -# -------------------------------------------------------------------------- - -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -def patch_sdk(): - pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.py deleted file mode 100644 index 0da100b4246..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/__init__.py +++ /dev/null @@ -1,57 +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 ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._build_service_operations import BuildServiceOperations -from ._buildpack_binding_operations import BuildpackBindingOperations -from ._build_service_builder_operations import BuildServiceBuilderOperations -from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._storages_operations import StoragesOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations -from ._gateways_operations import GatewaysOperations -from ._gateway_route_configs_operations import GatewayRouteConfigsOperations -from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations -from ._api_portals_operations import ApiPortalsOperations -from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations - -__all__ = [ - 'ServicesOperations', - 'ConfigServersOperations', - 'ConfigurationServicesOperations', - 'ServiceRegistriesOperations', - 'BuildServiceOperations', - 'BuildpackBindingOperations', - 'BuildServiceBuilderOperations', - 'BuildServiceAgentPoolOperations', - 'MonitoringSettingsOperations', - 'AppsOperations', - 'BindingsOperations', - 'StoragesOperations', - 'CertificatesOperations', - 'CustomDomainsOperations', - 'DeploymentsOperations', - 'Operations', - 'RuntimeVersionsOperations', - 'SkusOperations', - 'GatewaysOperations', - 'GatewayRouteConfigsOperations', - 'GatewayCustomDomainsOperations', - 'ApiPortalsOperations', - 'ApiPortalCustomDomainsOperations', -] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index bc1dd276e63..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,464 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._api_portal_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ApiPortalCustomDomainsOperations: - """ApiPortalCustomDomainsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.ApiPortalCustomDomainResource": - """Get the API portal custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiPortalCustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", - **kwargs: Any - ) -> "_models.ApiPortalCustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ApiPortalCustomDomainResource"]: - """Create or update the API portal custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_portal_custom_domain_resource=api_portal_custom_domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the API portal custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalCustomDomainResourceCollection"]: - """Handle requests to list all API portal custom domains. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py deleted file mode 100644 index 2f49464fc05..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_api_portals_operations.py +++ /dev/null @@ -1,512 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._api_portals_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ApiPortalsOperations: - """ApiPortalsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> "_models.ApiPortalResource": - """Get the API portal and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiPortalResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: "_models.ApiPortalResource", - **kwargs: Any - ) -> "_models.ApiPortalResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: "_models.ApiPortalResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ApiPortalResource"]: - """Create the default API portal or update the existing API portal. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_portal_resource=api_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the default API portal. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ApiPortalResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the domains are valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py deleted file mode 100644 index c1d78c25bbe..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_apps_operations.py +++ /dev/null @@ -1,853 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_get_resource_upload_url_request, build_list_request, build_set_active_deployments_request_initial, build_update_request_initial, build_validate_domain_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class AppsOperations: - """AppsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": - """Get an App and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AppResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.AppResource"]: - """Create a new App or update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the create or update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.AppResource"]: - """Operation to update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.AppResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore - - @distributed_trace_async - async def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for an App, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - async def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - - request = build_set_active_deployments_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._set_active_deployments_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - - @distributed_trace_async - async def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> AsyncLROPoller["_models.AppResource"]: - """Set existing Deployment under the app as active. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._set_active_deployments_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - active_deployment_collection=active_deployment_collection, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the resource name is valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py deleted file mode 100644 index ff5b8848165..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_bindings_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._bindings_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BindingsOperations: - """BindingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": - """Get a Binding and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BindingResource"]: - """Create a new Binding or update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BindingResource"]: - """Operation to update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BindingResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index 8c31315fc36..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,346 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_agent_pool_operations import build_get_request, build_list_request, build_update_put_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildServiceAgentPoolOperations: - """BuildServiceAgentPoolOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceAgentPoolResourceCollection"]: - """List build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - """Get build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildServiceAgentPoolResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BuildServiceAgentPoolResource"]: - """Create or update build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - agent_pool_resource=agent_pool_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py deleted file mode 100644 index 15ca47b7f80..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,462 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_builder_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildServiceBuilderOperations: - """BuildServiceBuilderOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> "_models.BuilderResource": - """Get a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuilderResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> "_models.BuilderResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(builder_resource, 'BuilderResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BuilderResource"]: - """Create or update a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. - :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - builder_resource=builder_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuilderResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuilderResourceCollection"]: - """List KPack builders result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py deleted file mode 100644 index 98ec096bafc..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_build_service_operations.py +++ /dev/null @@ -1,985 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._build_service_operations import build_create_or_update_build_request, build_get_build_request, build_get_build_result_log_request, build_get_build_result_request, build_get_build_service_request, build_get_resource_upload_url_request, build_get_supported_buildpack_request, build_get_supported_stack_request, build_list_build_results_request, build_list_build_services_request, build_list_builds_request, build_list_supported_buildpacks_request, build_list_supported_stacks_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildServiceOperations: - """BuildServiceOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_build_services( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildServiceCollection"]: - """List build services resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_build_services.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore - - @distributed_trace_async - async def get_build_service( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.BuildService": - """Get a build service resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildService, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_service_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_build_service.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildService', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore - - - @distributed_trace - def list_builds( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildCollection"]: - """List KPack builds. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_builds.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore - - @distributed_trace_async - async def get_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> "_models.Build": - """Get a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.get_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace_async - async def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: "_models.Build", - **kwargs: Any - ) -> "_models.Build": - """Create or update a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build: Parameters for the create or update operation. - :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(build, 'Build') - - request = build_create_or_update_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Build', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace - def list_build_results( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildResultCollection"]: - """List KPack build results. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.list_build_results.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildResultCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore - - @distributed_trace_async - async def get_build_result( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResult": - """Get a KPack build result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_result_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore - - - @distributed_trace_async - async def get_build_result_log( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResultLog": - """Get a KPack build result log download URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResultLog, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultLog - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_result_log_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result_log.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResultLog', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore - - - @distributed_trace_async - async def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for build service, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace_async - async def list_supported_buildpacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpacksCollection": - """Get all supported buildpacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_supported_buildpacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_buildpacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore - - - @distributed_trace_async - async def get_supported_buildpack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpackResource": - """Get the supported buildpack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. - :type buildpack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_supported_buildpack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - api_version=api_version, - template_url=self.get_supported_buildpack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore - - - @distributed_trace_async - async def list_supported_stacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedStacksCollection": - """Get all supported stacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_supported_stacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_stacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore - - - @distributed_trace_async - async def get_supported_stack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any - ) -> "_models.SupportedStackResource": - """Get the supported stack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param stack_name: The name of the stack resource. - :type stack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_supported_stack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - api_version=api_version, - template_url=self.get_supported_stack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py deleted file mode 100644 index 3cb2c20da4c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,484 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._buildpack_binding_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class BuildpackBindingOperations: - """BuildpackBindingOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - """Get a buildpack binding by name. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildpackBindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.BuildpackBindingResource"]: - """Create or update a buildpack binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BuildpackBindingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - buildpack_binding=buildpack_binding, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Buildpack Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.BuildpackBindingResourceCollection"]: - """Handles requests to list all buildpack bindings in a builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py deleted file mode 100644 index a5c1f9d4822..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_certificates_operations.py +++ /dev/null @@ -1,445 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._certificates_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class CertificatesOperations: - """CertificatesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": - """Get the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.CertificateResource"]: - """Create or update certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.CertificateResourceCollection"]: - """List all the certificates of one user. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py deleted file mode 100644 index 0aee3558712..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_config_servers_operations.py +++ /dev/null @@ -1,495 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._config_servers_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial, build_validate_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ConfigServersOperations: - """ConfigServersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": - """Get the config server and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigServerResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigServerSettingsValidateResult"]: - """Check if the config server settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigServerSettingsValidateResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py deleted file mode 100644 index c7b36fd45a1..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_configuration_services_operations.py +++ /dev/null @@ -1,578 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._configuration_services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ConfigurationServicesOperations: - """ConfigurationServicesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - """Get the Application Configuration Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigurationServiceResource"]: - """Create the default Application Configuration Service or update the existing Application - Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Application Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ConfigurationServiceResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore - - async def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> "_models.ConfigurationServiceSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(settings, 'ConfigurationServiceSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore - - - @distributed_trace_async - async def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> AsyncLROPoller["_models.ConfigurationServiceSettingsValidateResult"]: - """Check if the Application Configuration Service settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. - :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - settings=settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py deleted file mode 100644 index bde04206fe5..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_custom_domains_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class CustomDomainsOperations: - """CustomDomainsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": - """Get the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.CustomDomainResource"]: - """Create or update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.CustomDomainResource"]: - """Update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.CustomDomainResourceCollection"]: - """List the custom domains of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py deleted file mode 100644 index e746cc785ad..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_deployments_operations.py +++ /dev/null @@ -1,1509 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, List, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._deployments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_generate_heap_dump_request_initial, build_generate_thread_dump_request_initial, build_get_log_file_url_request, build_get_request, build_list_for_cluster_request, build_list_request, build_restart_request_initial, build_start_jfr_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DeploymentsOperations: # pylint: disable=too-many-public-methods - """DeploymentsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": - """Get a Deployment and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.DeploymentResource"]: - """Create a new Deployment or update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.DeploymentResource"]: - """Operation to update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> AsyncIterable["_models.DeploymentResourceCollection"]: - """List deployments for a certain service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Start the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Stop the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - - @distributed_trace_async - async def begin_restart( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restart the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - @distributed_trace_async - async def get_log_file_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: - """Get deployment log file URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogFileUrlResponse, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.LogFileUrlResponse or None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - async def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - - @distributed_trace_async - async def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Generate Heap Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._generate_heap_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - async def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - - @distributed_trace_async - async def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Generate Thread Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._generate_thread_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - async def _start_jfr_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore - - - @distributed_trace_async - async def begin_start_jfr( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Start JFR. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_jfr_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index 97cbd33073f..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,464 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._gateway_custom_domains_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class GatewayCustomDomainsOperations: - """GatewayCustomDomainsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.GatewayCustomDomainResource": - """Get the Spring Cloud Gateway custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GatewayCustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", - **kwargs: Any - ) -> "_models.GatewayCustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.GatewayCustomDomainResource"]: - """Create or update the Spring Cloud Gateway custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - gateway_custom_domain_resource=gateway_custom_domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the Spring Cloud Gateway custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.GatewayCustomDomainResourceCollection"]: - """Handle requests to list all Spring Cloud Gateway custom domains. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 0ffbd29ea9c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,465 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._gateway_route_configs_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class GatewayRouteConfigsOperations: - """GatewayRouteConfigsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> "_models.GatewayRouteConfigResource": - """Get the Spring Cloud Gateway route configs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. - :type route_config_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GatewayRouteConfigResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: "_models.GatewayRouteConfigResource", - **kwargs: Any - ) -> "_models.GatewayRouteConfigResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: "_models.GatewayRouteConfigResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.GatewayRouteConfigResource"]: - """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud - Gateway route configs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayRouteConfigResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - gateway_route_config_resource=gateway_route_config_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the Spring Cloud Gateway route config. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. - :type route_config_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.GatewayRouteConfigResourceCollection"]: - """Handle requests to list all Spring Cloud Gateway route configs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py deleted file mode 100644 index 71c8d9c05db..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,512 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._gateways_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_validate_domain_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class GatewaysOperations: - """GatewaysOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> "_models.GatewayResource": - """Get the Spring Cloud Gateway and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GatewayResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GatewayResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: "_models.GatewayResource", - **kwargs: Any - ) -> "_models.GatewayResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_resource, 'GatewayResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('GatewayResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('GatewayResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: "_models.GatewayResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.GatewayResource"]: - """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_resource=gateway_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GatewayResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Spring Cloud Gateway. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.GatewayResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore - - @distributed_trace_async - async def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the domains are valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py deleted file mode 100644 index 592b75bc3d1..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,365 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._monitoring_settings_operations import build_get_request, build_update_patch_request_initial, build_update_put_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class MonitoringSettingsOperations: - """MonitoringSettingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - """Get the Monitoring Setting and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MonitoringSettingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - async def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - async def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace_async - async def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MonitoringSettingResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py deleted file mode 100644 index 729c941a718..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_operations.py +++ /dev/null @@ -1,115 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.AvailableOperations"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableOperations] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py deleted file mode 100644 index c3875b6b2aa..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,93 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._runtime_versions_operations import build_list_runtime_versions_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class RuntimeVersionsOperations: - """RuntimeVersionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def list_runtime_versions( - self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailableRuntimeVersions, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableRuntimeVersions - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py deleted file mode 100644 index 33d846f4936..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_service_registries_operations.py +++ /dev/null @@ -1,430 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._service_registries_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ServiceRegistriesOperations: - """ServiceRegistriesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - """Get the Service Registry and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceRegistryResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceRegistryResource"]: - """Create the default Service Registry or update the existing Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceRegistryResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Disable the default Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ServiceRegistryResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py deleted file mode 100644 index f27d352f11c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_services_operations.py +++ /dev/null @@ -1,1135 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._services_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_disable_test_endpoint_request, build_enable_test_endpoint_request, build_get_request, build_list_by_subscription_request, build_list_request, build_list_test_keys_request, build_regenerate_test_key_request, build_start_request_initial, build_stop_request_initial, build_update_request_initial -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ServicesOperations: - """ServicesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": - """Get a Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: - """Create a new Service or update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the create or update operation. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Operation to delete a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - async def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: - """Operation to update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the update operation. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace_async - async def list_test_keys( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """List test keys for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace_async - async def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": - """Regenerate a test key for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace_async - async def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - """Disable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - - - @distributed_trace_async - async def enable_test_endpoint( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """Enable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - - - @distributed_trace_async - async def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Stop a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - - - @distributed_trace_async - async def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Start a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - - @distributed_trace_async - async def check_name_availability( - self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": - """Checks that the resource name is valid and is not already in use. - - :param location: the region. - :type location: str - :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailability, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NameAvailability', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a resource group. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py deleted file mode 100644 index b540584f4bc..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_skus_operations.py +++ /dev/null @@ -1,118 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._skus_operations import build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class SkusOperations: - """SkusOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ResourceSkuCollection"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py deleted file mode 100644 index ca59fae045d..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/aio/operations/_storages_operations.py +++ /dev/null @@ -1,444 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._storages_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class StoragesOperations: - """StoragesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> "_models.StorageResource": - """Get the storage resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param storage_name: The name of the storage resource. - :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('StorageResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - async def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> "_models.StorageResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(storage_resource, 'StorageResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('StorageResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('StorageResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('StorageResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> AsyncLROPoller["_models.StorageResource"]: - """Create or update storage resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param storage_name: The name of the storage resource. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. - :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - storage_resource=storage_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('StorageResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace_async - async def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete the storage resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param storage_name: The name of the storage resource. - :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.StorageResourceCollection"]: - """List all the storages of one Azure Spring Apps resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("StorageResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py deleted file mode 100644 index 6d9492be191..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/__init__.py +++ /dev/null @@ -1,441 +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 ._models_py3 import ActiveDeploymentCollection -from ._models_py3 import ApiPortalCustomDomainProperties -from ._models_py3 import ApiPortalCustomDomainResource -from ._models_py3 import ApiPortalCustomDomainResourceCollection -from ._models_py3 import ApiPortalInstance -from ._models_py3 import ApiPortalProperties -from ._models_py3 import ApiPortalResource -from ._models_py3 import ApiPortalResourceCollection -from ._models_py3 import ApiPortalResourceRequests -from ._models_py3 import AppResource -from ._models_py3 import AppResourceCollection -from ._models_py3 import AppResourceProperties -from ._models_py3 import AppVNetAddons -from ._models_py3 import ApplicationInsightsAgentVersions -from ._models_py3 import AvailableOperations -from ._models_py3 import AvailableRuntimeVersions -from ._models_py3 import AzureFileVolume -from ._models_py3 import BindingResource -from ._models_py3 import BindingResourceCollection -from ._models_py3 import BindingResourceProperties -from ._models_py3 import Build -from ._models_py3 import BuildCollection -from ._models_py3 import BuildProperties -from ._models_py3 import BuildResourceRequests -from ._models_py3 import BuildResult -from ._models_py3 import BuildResultCollection -from ._models_py3 import BuildResultLog -from ._models_py3 import BuildResultProperties -from ._models_py3 import BuildResultUserSourceInfo -from ._models_py3 import BuildService -from ._models_py3 import BuildServiceAgentPoolProperties -from ._models_py3 import BuildServiceAgentPoolResource -from ._models_py3 import BuildServiceAgentPoolResourceCollection -from ._models_py3 import BuildServiceAgentPoolSizeProperties -from ._models_py3 import BuildServiceCollection -from ._models_py3 import BuildServiceProperties -from ._models_py3 import BuildServicePropertiesResourceRequests -from ._models_py3 import BuildStageProperties -from ._models_py3 import BuilderProperties -from ._models_py3 import BuilderResource -from ._models_py3 import BuilderResourceCollection -from ._models_py3 import BuildpackBindingLaunchProperties -from ._models_py3 import BuildpackBindingProperties -from ._models_py3 import BuildpackBindingResource -from ._models_py3 import BuildpackBindingResourceCollection -from ._models_py3 import BuildpackProperties -from ._models_py3 import BuildpacksGroupProperties -from ._models_py3 import CertificateProperties -from ._models_py3 import CertificateResource -from ._models_py3 import CertificateResourceCollection -from ._models_py3 import CloudErrorBody -from ._models_py3 import ClusterResourceProperties -from ._models_py3 import ConfigServerGitProperty -from ._models_py3 import ConfigServerProperties -from ._models_py3 import ConfigServerResource -from ._models_py3 import ConfigServerSettings -from ._models_py3 import ConfigServerSettingsErrorRecord -from ._models_py3 import ConfigServerSettingsValidateResult -from ._models_py3 import ConfigurationServiceGitProperty -from ._models_py3 import ConfigurationServiceGitPropertyValidateResult -from ._models_py3 import ConfigurationServiceGitRepository -from ._models_py3 import ConfigurationServiceInstance -from ._models_py3 import ConfigurationServiceProperties -from ._models_py3 import ConfigurationServiceResource -from ._models_py3 import ConfigurationServiceResourceCollection -from ._models_py3 import ConfigurationServiceResourceRequests -from ._models_py3 import ConfigurationServiceSettings -from ._models_py3 import ConfigurationServiceSettingsValidateResult -from ._models_py3 import ContainerProbeSettings -from ._models_py3 import ContentCertificateProperties -from ._models_py3 import CustomContainer -from ._models_py3 import CustomContainerUserSourceInfo -from ._models_py3 import CustomDomainProperties -from ._models_py3 import CustomDomainResource -from ._models_py3 import CustomDomainResourceCollection -from ._models_py3 import CustomDomainValidatePayload -from ._models_py3 import CustomDomainValidateResult -from ._models_py3 import CustomPersistentDiskProperties -from ._models_py3 import CustomPersistentDiskResource -from ._models_py3 import DeploymentInstance -from ._models_py3 import DeploymentResource -from ._models_py3 import DeploymentResourceCollection -from ._models_py3 import DeploymentResourceProperties -from ._models_py3 import DeploymentSettings -from ._models_py3 import DiagnosticParameters -from ._models_py3 import Error -from ._models_py3 import ExecAction -from ._models_py3 import GatewayApiMetadataProperties -from ._models_py3 import GatewayApiRoute -from ._models_py3 import GatewayCorsProperties -from ._models_py3 import GatewayCustomDomainProperties -from ._models_py3 import GatewayCustomDomainResource -from ._models_py3 import GatewayCustomDomainResourceCollection -from ._models_py3 import GatewayInstance -from ._models_py3 import GatewayOperatorProperties -from ._models_py3 import GatewayOperatorResourceRequests -from ._models_py3 import GatewayProperties -from ._models_py3 import GatewayResource -from ._models_py3 import GatewayResourceCollection -from ._models_py3 import GatewayResourceRequests -from ._models_py3 import GatewayRouteConfigOpenApiProperties -from ._models_py3 import GatewayRouteConfigProperties -from ._models_py3 import GatewayRouteConfigResource -from ._models_py3 import GatewayRouteConfigResourceCollection -from ._models_py3 import GitPatternRepository -from ._models_py3 import HTTPGetAction -from ._models_py3 import ImageRegistryCredential -from ._models_py3 import IngressConfig -from ._models_py3 import JarUploadedUserSourceInfo -from ._models_py3 import KeyVaultCertificateProperties -from ._models_py3 import LoadedCertificate -from ._models_py3 import LogFileUrlResponse -from ._models_py3 import LogSpecification -from ._models_py3 import ManagedIdentityProperties -from ._models_py3 import MarketplaceResource -from ._models_py3 import MetricDimension -from ._models_py3 import MetricSpecification -from ._models_py3 import MonitoringSettingProperties -from ._models_py3 import MonitoringSettingResource -from ._models_py3 import NameAvailability -from ._models_py3 import NameAvailabilityParameters -from ._models_py3 import NetCoreZipUploadedUserSourceInfo -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileOutboundIPs -from ._models_py3 import OperationDetail -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationProperties -from ._models_py3 import PersistentDisk -from ._models_py3 import Probe -from ._models_py3 import ProbeAction -from ._models_py3 import ProxyResource -from ._models_py3 import RegenerateTestKeyRequestPayload -from ._models_py3 import RequiredTraffic -from ._models_py3 import Resource -from ._models_py3 import ResourceRequests -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuCapabilities -from ._models_py3 import ResourceSkuCollection -from ._models_py3 import ResourceSkuLocationInfo -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import ResourceSkuZoneDetails -from ._models_py3 import ResourceUploadDefinition -from ._models_py3 import ServiceRegistryInstance -from ._models_py3 import ServiceRegistryProperties -from ._models_py3 import ServiceRegistryResource -from ._models_py3 import ServiceRegistryResourceCollection -from ._models_py3 import ServiceRegistryResourceRequests -from ._models_py3 import ServiceResource -from ._models_py3 import ServiceResourceList -from ._models_py3 import ServiceSpecification -from ._models_py3 import ServiceVNetAddons -from ._models_py3 import Sku -from ._models_py3 import SkuCapacity -from ._models_py3 import SourceUploadedUserSourceInfo -from ._models_py3 import SsoProperties -from ._models_py3 import StackProperties -from ._models_py3 import StorageAccount -from ._models_py3 import StorageProperties -from ._models_py3 import StorageResource -from ._models_py3 import StorageResourceCollection -from ._models_py3 import SupportedBuildpackResource -from ._models_py3 import SupportedBuildpackResourceProperties -from ._models_py3 import SupportedBuildpacksCollection -from ._models_py3 import SupportedRuntimeVersion -from ._models_py3 import SupportedStackResource -from ._models_py3 import SupportedStackResourceProperties -from ._models_py3 import SupportedStacksCollection -from ._models_py3 import SystemData -from ._models_py3 import TCPSocketAction -from ._models_py3 import TemporaryDisk -from ._models_py3 import TestKeys -from ._models_py3 import TrackedResource -from ._models_py3 import TriggeredBuildResult -from ._models_py3 import UploadedUserSourceInfo -from ._models_py3 import UserAssignedManagedIdentity -from ._models_py3 import UserSourceInfo -from ._models_py3 import ValidationMessages - - -from ._app_platform_management_client_enums import ( - ActionType, - ApiPortalProvisioningState, - AppResourceProvisioningState, - BindingType, - BuildProvisioningState, - BuildResultProvisioningState, - BuildServiceProvisioningState, - BuilderProvisioningState, - BuildpackBindingProvisioningState, - CertificateResourceProvisioningState, - ConfigServerState, - ConfigurationServiceProvisioningState, - CreatedByType, - CustomDomainResourceProvisioningState, - DeploymentResourceProvisioningState, - DeploymentResourceStatus, - GatewayProvisioningState, - HTTPSchemeType, - KPackBuildStageProvisioningState, - LastModifiedByType, - ManagedIdentityType, - MonitoringSettingState, - PowerState, - ProbeActionType, - ProvisioningState, - ResourceSkuRestrictionsReasonCode, - ResourceSkuRestrictionsType, - ServiceRegistryProvisioningState, - SkuScaleType, - StorageType, - SupportedRuntimePlatform, - SupportedRuntimeValue, - TestKeyType, - TrafficDirection, - Type, -) - -__all__ = [ - 'ActiveDeploymentCollection', - 'ApiPortalCustomDomainProperties', - 'ApiPortalCustomDomainResource', - 'ApiPortalCustomDomainResourceCollection', - 'ApiPortalInstance', - 'ApiPortalProperties', - 'ApiPortalResource', - 'ApiPortalResourceCollection', - 'ApiPortalResourceRequests', - 'AppResource', - 'AppResourceCollection', - 'AppResourceProperties', - 'AppVNetAddons', - 'ApplicationInsightsAgentVersions', - 'AvailableOperations', - 'AvailableRuntimeVersions', - 'AzureFileVolume', - 'BindingResource', - 'BindingResourceCollection', - 'BindingResourceProperties', - 'Build', - 'BuildCollection', - 'BuildProperties', - 'BuildResourceRequests', - 'BuildResult', - 'BuildResultCollection', - 'BuildResultLog', - 'BuildResultProperties', - 'BuildResultUserSourceInfo', - 'BuildService', - 'BuildServiceAgentPoolProperties', - 'BuildServiceAgentPoolResource', - 'BuildServiceAgentPoolResourceCollection', - 'BuildServiceAgentPoolSizeProperties', - 'BuildServiceCollection', - 'BuildServiceProperties', - 'BuildServicePropertiesResourceRequests', - 'BuildStageProperties', - 'BuilderProperties', - 'BuilderResource', - 'BuilderResourceCollection', - 'BuildpackBindingLaunchProperties', - 'BuildpackBindingProperties', - 'BuildpackBindingResource', - 'BuildpackBindingResourceCollection', - 'BuildpackProperties', - 'BuildpacksGroupProperties', - 'CertificateProperties', - 'CertificateResource', - 'CertificateResourceCollection', - 'CloudErrorBody', - 'ClusterResourceProperties', - 'ConfigServerGitProperty', - 'ConfigServerProperties', - 'ConfigServerResource', - 'ConfigServerSettings', - 'ConfigServerSettingsErrorRecord', - 'ConfigServerSettingsValidateResult', - 'ConfigurationServiceGitProperty', - 'ConfigurationServiceGitPropertyValidateResult', - 'ConfigurationServiceGitRepository', - 'ConfigurationServiceInstance', - 'ConfigurationServiceProperties', - 'ConfigurationServiceResource', - 'ConfigurationServiceResourceCollection', - 'ConfigurationServiceResourceRequests', - 'ConfigurationServiceSettings', - 'ConfigurationServiceSettingsValidateResult', - 'ContainerProbeSettings', - 'ContentCertificateProperties', - 'CustomContainer', - 'CustomContainerUserSourceInfo', - 'CustomDomainProperties', - 'CustomDomainResource', - 'CustomDomainResourceCollection', - 'CustomDomainValidatePayload', - 'CustomDomainValidateResult', - 'CustomPersistentDiskProperties', - 'CustomPersistentDiskResource', - 'DeploymentInstance', - 'DeploymentResource', - 'DeploymentResourceCollection', - 'DeploymentResourceProperties', - 'DeploymentSettings', - 'DiagnosticParameters', - 'Error', - 'ExecAction', - 'GatewayApiMetadataProperties', - 'GatewayApiRoute', - 'GatewayCorsProperties', - 'GatewayCustomDomainProperties', - 'GatewayCustomDomainResource', - 'GatewayCustomDomainResourceCollection', - 'GatewayInstance', - 'GatewayOperatorProperties', - 'GatewayOperatorResourceRequests', - 'GatewayProperties', - 'GatewayResource', - 'GatewayResourceCollection', - 'GatewayResourceRequests', - 'GatewayRouteConfigOpenApiProperties', - 'GatewayRouteConfigProperties', - 'GatewayRouteConfigResource', - 'GatewayRouteConfigResourceCollection', - 'GitPatternRepository', - 'HTTPGetAction', - 'ImageRegistryCredential', - 'IngressConfig', - 'JarUploadedUserSourceInfo', - 'KeyVaultCertificateProperties', - 'LoadedCertificate', - 'LogFileUrlResponse', - 'LogSpecification', - 'ManagedIdentityProperties', - 'MarketplaceResource', - 'MetricDimension', - 'MetricSpecification', - 'MonitoringSettingProperties', - 'MonitoringSettingResource', - 'NameAvailability', - 'NameAvailabilityParameters', - 'NetCoreZipUploadedUserSourceInfo', - 'NetworkProfile', - 'NetworkProfileOutboundIPs', - 'OperationDetail', - 'OperationDisplay', - 'OperationProperties', - 'PersistentDisk', - 'Probe', - 'ProbeAction', - 'ProxyResource', - 'RegenerateTestKeyRequestPayload', - 'RequiredTraffic', - 'Resource', - 'ResourceRequests', - 'ResourceSku', - 'ResourceSkuCapabilities', - 'ResourceSkuCollection', - 'ResourceSkuLocationInfo', - 'ResourceSkuRestrictionInfo', - 'ResourceSkuRestrictions', - 'ResourceSkuZoneDetails', - 'ResourceUploadDefinition', - 'ServiceRegistryInstance', - 'ServiceRegistryProperties', - 'ServiceRegistryResource', - 'ServiceRegistryResourceCollection', - 'ServiceRegistryResourceRequests', - 'ServiceResource', - 'ServiceResourceList', - 'ServiceSpecification', - 'ServiceVNetAddons', - 'Sku', - 'SkuCapacity', - 'SourceUploadedUserSourceInfo', - 'SsoProperties', - 'StackProperties', - 'StorageAccount', - 'StorageProperties', - 'StorageResource', - 'StorageResourceCollection', - 'SupportedBuildpackResource', - 'SupportedBuildpackResourceProperties', - 'SupportedBuildpacksCollection', - 'SupportedRuntimeVersion', - 'SupportedStackResource', - 'SupportedStackResourceProperties', - 'SupportedStacksCollection', - 'SystemData', - 'TCPSocketAction', - 'TemporaryDisk', - 'TestKeys', - 'TrackedResource', - 'TriggeredBuildResult', - 'UploadedUserSourceInfo', - 'UserAssignedManagedIdentity', - 'UserSourceInfo', - 'ValidationMessages', - 'ActionType', - 'ApiPortalProvisioningState', - 'AppResourceProvisioningState', - 'BindingType', - 'BuildProvisioningState', - 'BuildResultProvisioningState', - 'BuildServiceProvisioningState', - 'BuilderProvisioningState', - 'BuildpackBindingProvisioningState', - 'CertificateResourceProvisioningState', - 'ConfigServerState', - 'ConfigurationServiceProvisioningState', - 'CreatedByType', - 'CustomDomainResourceProvisioningState', - 'DeploymentResourceProvisioningState', - 'DeploymentResourceStatus', - 'GatewayProvisioningState', - 'HTTPSchemeType', - 'KPackBuildStageProvisioningState', - 'LastModifiedByType', - 'ManagedIdentityType', - 'MonitoringSettingState', - 'PowerState', - 'ProbeActionType', - 'ProvisioningState', - 'ResourceSkuRestrictionsReasonCode', - 'ResourceSkuRestrictionsType', - 'ServiceRegistryProvisioningState', - 'SkuScaleType', - 'StorageType', - 'SupportedRuntimePlatform', - 'SupportedRuntimeValue', - 'TestKeyType', - 'TrafficDirection', - 'Type', -] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py deleted file mode 100644 index 593ef2e2513..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_app_platform_management_client_enums.py +++ /dev/null @@ -1,329 +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 enum import Enum -from six import with_metaclass -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - """ - - INTERNAL = "Internal" - -class ApiPortalProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the API portal. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class AppResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the App - """ - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - -class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Buildpack Binding Type - """ - - APPLICATION_INSIGHTS = "ApplicationInsights" - APACHE_SKY_WALKING = "ApacheSkyWalking" - APP_DYNAMICS = "AppDynamics" - DYNATRACE = "Dynatrace" - NEW_RELIC = "NewRelic" - ELASTIC_APM = "ElasticAPM" - -class BuilderProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Builder provision status. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildpackBindingProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Buildpack Binding. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the KPack build result - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildResultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the KPack build result - """ - - QUEUING = "Queuing" - BUILDING = "Building" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class BuildServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the KPack build result - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class CertificateResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the Certificate - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class ConfigServerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the config server. - """ - - NOT_AVAILABLE = "NotAvailable" - DELETED = "Deleted" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - -class ConfigurationServiceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Application Configuration Service. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that created the resource. - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -class CustomDomainResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the Domain - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class DeploymentResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the Deployment - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - -class DeploymentResourceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Status of the Deployment - """ - - STOPPED = "Stopped" - RUNNING = "Running" - -class GatewayProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Spring Cloud Gateway. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class HTTPSchemeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https:// - """ - - HTTP = "HTTP" - HTTPS = "HTTPS" - -class KPackBuildStageProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The provisioning state of this build stage resource. - """ - - NOT_STARTED = "NotStarted" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - -class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that last modified the resource. - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of the managed identity - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" - -class MonitoringSettingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Monitoring Setting. - """ - - NOT_AVAILABLE = "NotAvailable" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - UPDATING = "Updating" - -class PowerState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Power state of the Service - """ - - RUNNING = "Running" - STOPPED = "Stopped" - -class ProbeActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the action to take to perform the health check. - """ - - HTTP_GET_ACTION = "HTTPGetAction" - TCP_SOCKET_ACTION = "TCPSocketAction" - EXEC_ACTION = "ExecAction" - -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the Service - """ - - CREATING = "Creating" - UPDATING = "Updating" - STARTING = "Starting" - STOPPING = "Stopping" - DELETING = "Deleting" - DELETED = "Deleted" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - MOVING = "Moving" - MOVED = "Moved" - MOVE_FAILED = "MoveFailed" - -class ResourceSkuRestrictionsReasonCode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription' - """ - - QUOTA_ID = "QuotaId" - NOT_AVAILABLE_FOR_SUBSCRIPTION = "NotAvailableForSubscription" - -class ResourceSkuRestrictionsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets the type of restrictions. Possible values include: 'Location', 'Zone' - """ - - LOCATION = "Location" - ZONE = "Zone" - -class ServiceRegistryProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """State of the Service Registry. - """ - - CREATING = "Creating" - UPDATING = "Updating" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - DELETING = "Deleting" - -class SkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Gets or sets the type of the scale. - """ - - NONE = "None" - MANUAL = "Manual" - AUTOMATIC = "Automatic" - -class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the storage. - """ - - STORAGE_ACCOUNT = "StorageAccount" - -class SupportedRuntimePlatform(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The platform of this runtime version (possible values: "Java" or ".NET"). - """ - - JAVA = "Java" - _NET_CORE = ".NET Core" - -class SupportedRuntimeValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The raw value which could be passed to deployment CRUD operations. - """ - - JAVA8 = "Java_8" - JAVA11 = "Java_11" - JAVA17 = "Java_17" - NET_CORE31 = "NetCore_31" - -class TestKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """Type of the test key - """ - - PRIMARY = "Primary" - SECONDARY = "Secondary" - -class TrafficDirection(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The direction of required traffic - """ - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - -class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): - """The type of the underlying resource to mount as a persistent disk. - """ - - AZURE_FILE_VOLUME = "AzureFileVolume" diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py deleted file mode 100644 index a01cb1cec2a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/models/_models_py3.py +++ /dev/null @@ -1,8111 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Optional, Union - -import msrest.serialization - -from ._app_platform_management_client_enums import * - - -class ActiveDeploymentCollection(msrest.serialization.Model): - """Object that includes an array of Deployment resource name and set them as active. - - :ivar active_deployment_names: Collection of Deployment name. - :vartype active_deployment_names: list[str] - """ - - _attribute_map = { - 'active_deployment_names': {'key': 'activeDeploymentNames', 'type': '[str]'}, - } - - def __init__( - self, - *, - active_deployment_names: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword active_deployment_names: Collection of Deployment name. - :paramtype active_deployment_names: list[str] - """ - super(ActiveDeploymentCollection, self).__init__(**kwargs) - self.active_deployment_names = active_deployment_names - - -class ApiPortalCustomDomainProperties(msrest.serialization.Model): - """The properties of custom domain for API portal. - - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str - """ - - _attribute_map = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - } - - def __init__( - self, - *, - thumbprint: Optional[str] = None, - **kwargs - ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super(ApiPortalCustomDomainProperties, self).__init__(**kwargs) - self.thumbprint = thumbprint - - -class Resource(msrest.serialization.Model): - """The core properties of ARM resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ProxyResource, self).__init__(**kwargs) - - -class ApiPortalCustomDomainResource(ProxyResource): - """Custom domain of the API portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for API portal. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainProperties - """ - - _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': 'ApiPortalCustomDomainProperties'}, - } - - def __init__( - self, - *, - properties: Optional["ApiPortalCustomDomainProperties"] = None, - **kwargs - ): - """ - :keyword properties: The properties of custom domain for API portal. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainProperties - """ - super(ApiPortalCustomDomainResource, self).__init__(**kwargs) - self.properties = properties - - -class ApiPortalCustomDomainResourceCollection(msrest.serialization.Model): - """Object that includes an array of API portal custom domain resources and a possible link for next set. - - :ivar value: Collection of API portal custom domain resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApiPortalCustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ApiPortalCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of API portal custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ApiPortalCustomDomainResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalInstance(msrest.serialization.Model): - """Collection of instances belong to the API portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the API portal instance. - :vartype name: str - :ivar status: Status of the API portal instance. - :vartype status: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ApiPortalInstance, self).__init__(**kwargs) - self.name = None - self.status = None - - -class ApiPortalProperties(msrest.serialization.Model): - """API portal properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the API portal. Possible values include: "Creating", - "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProvisioningState - :ivar public: Indicates whether the API portal exposes endpoint. - :vartype public: bool - :ivar url: URL of the API portal, exposed when 'public' is true. - :vartype url: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool - :ivar gateway_ids: The array of resource Ids of gateway to integrate with API portal. - :vartype gateway_ids: list[str] - :ivar source_urls: Collection of OpenAPI source URL locations. - :vartype source_urls: list[str] - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResourceRequests - :ivar instances: Collection of instances belong to API portal. - :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalInstance] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'url': {'readonly': True}, - 'resource_requests': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'public': {'key': 'public', 'type': 'bool'}, - 'url': {'key': 'url', 'type': 'str'}, - 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, - 'gateway_ids': {'key': 'gatewayIds', 'type': '[str]'}, - 'source_urls': {'key': 'sourceUrls', 'type': '[str]'}, - 'sso_properties': {'key': 'ssoProperties', 'type': 'SsoProperties'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'ApiPortalResourceRequests'}, - 'instances': {'key': 'instances', 'type': '[ApiPortalInstance]'}, - } - - def __init__( - self, - *, - public: Optional[bool] = False, - https_only: Optional[bool] = False, - gateway_ids: Optional[List[str]] = None, - source_urls: Optional[List[str]] = None, - sso_properties: Optional["SsoProperties"] = None, - **kwargs - ): - """ - :keyword public: Indicates whether the API portal exposes endpoint. - :paramtype public: bool - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword gateway_ids: The array of resource Ids of gateway to integrate with API portal. - :paramtype gateway_ids: list[str] - :keyword source_urls: Collection of OpenAPI source URL locations. - :paramtype source_urls: list[str] - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties - """ - super(ApiPortalProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.public = public - self.url = None - self.https_only = https_only - self.gateway_ids = gateway_ids - self.source_urls = source_urls - self.sso_properties = sso_properties - self.resource_requests = None - self.instances = None - - -class ApiPortalResource(ProxyResource): - """API portal 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: API portal properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProperties - :ivar sku: Sku of the API portal resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - - _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': 'ApiPortalProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__( - self, - *, - properties: Optional["ApiPortalProperties"] = None, - sku: Optional["Sku"] = None, - **kwargs - ): - """ - :keyword properties: API portal properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalProperties - :keyword sku: Sku of the API portal resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super(ApiPortalResource, self).__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class ApiPortalResourceCollection(msrest.serialization.Model): - """Object that includes an array of API portal resources and a possible link for next set. - - :ivar value: Collection of API portal resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApiPortalResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ApiPortalResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of API portal resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ApiPortalResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ApiPortalResourceRequests(msrest.serialization.Model): - """Resource requests of the API portal. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each API portal instance. - :vartype cpu: str - :ivar memory: Memory allocated to each API portal instance. - :vartype memory: str - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ApiPortalResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - - -class ApplicationInsightsAgentVersions(msrest.serialization.Model): - """Application Insights agent versions properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar java: Indicates the version of application insight java agent. - :vartype java: str - """ - - _validation = { - 'java': {'readonly': True}, - } - - _attribute_map = { - 'java': {'key': 'java', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ApplicationInsightsAgentVersions, self).__init__(**kwargs) - self.java = None - - -class AppResource(ProxyResource): - """App resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the App resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProperties - :ivar identity: The Managed Identity type of the app resource. - :vartype identity: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityProperties - :ivar location: The GEO location of the application, always the same with its parent resource. - :vartype location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'AppResourceProperties'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentityProperties'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - *, - properties: Optional["AppResourceProperties"] = None, - identity: Optional["ManagedIdentityProperties"] = None, - location: Optional[str] = None, - **kwargs - ): - """ - :keyword properties: Properties of the App resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProperties - :keyword identity: The Managed Identity type of the app resource. - :paramtype identity: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityProperties - :keyword location: The GEO location of the application, always the same with its parent - resource. - :paramtype location: str - """ - super(AppResource, self).__init__(**kwargs) - self.properties = properties - self.identity = identity - self.location = location - - -class AppResourceCollection(msrest.serialization.Model): - """Object that includes an array of App resources and a possible link for next set. - - :ivar value: Collection of App resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AppResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["AppResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of App resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(AppResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AppResourceProperties(msrest.serialization.Model): - """App resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public: Indicates whether the App exposes public endpoint. - :vartype public: bool - :ivar url: URL of the App. - :vartype url: str - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, dict[str, any]] - :ivar provisioning_state: Provisioning state of the App. Possible values include: "Succeeded", - "Failed", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceProvisioningState - :ivar fqdn: Fully qualified dns Name. - :vartype fqdn: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool - :ivar temporary_disk: Temporary disk settings. - :vartype temporary_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TemporaryDisk - :ivar persistent_disk: Persistent disk settings. - :vartype persistent_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.PersistentDisk - :ivar custom_persistent_disks: List of custom persistent disks. - :vartype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskResource] - :ivar enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :vartype enable_end_to_end_tls: bool - :ivar loaded_certificates: Collection of loaded certificates. - :vartype loaded_certificates: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LoadedCertificate] - :ivar vnet_addons: Additional App settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppVNetAddons - """ - - _validation = { - 'url': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'public': {'key': 'public', 'type': 'bool'}, - 'url': {'key': 'url', 'type': 'str'}, - 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, - 'temporary_disk': {'key': 'temporaryDisk', 'type': 'TemporaryDisk'}, - 'persistent_disk': {'key': 'persistentDisk', 'type': 'PersistentDisk'}, - 'custom_persistent_disks': {'key': 'customPersistentDisks', 'type': '[CustomPersistentDiskResource]'}, - 'enable_end_to_end_tls': {'key': 'enableEndToEndTLS', 'type': 'bool'}, - 'loaded_certificates': {'key': 'loadedCertificates', 'type': '[LoadedCertificate]'}, - 'vnet_addons': {'key': 'vnetAddons', 'type': 'AppVNetAddons'}, - } - - def __init__( - self, - *, - public: Optional[bool] = None, - addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, - fqdn: Optional[str] = None, - https_only: Optional[bool] = False, - temporary_disk: Optional["TemporaryDisk"] = None, - persistent_disk: Optional["PersistentDisk"] = None, - custom_persistent_disks: Optional[List["CustomPersistentDiskResource"]] = None, - enable_end_to_end_tls: Optional[bool] = False, - loaded_certificates: Optional[List["LoadedCertificate"]] = None, - vnet_addons: Optional["AppVNetAddons"] = None, - **kwargs - ): - """ - :keyword public: Indicates whether the App exposes public endpoint. - :paramtype public: bool - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, dict[str, any]] - :keyword fqdn: Fully qualified dns Name. - :paramtype fqdn: str - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword temporary_disk: Temporary disk settings. - :paramtype temporary_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TemporaryDisk - :keyword persistent_disk: Persistent disk settings. - :paramtype persistent_disk: ~azure.mgmt.appplatform.v2022_05_01_preview.models.PersistentDisk - :keyword custom_persistent_disks: List of custom persistent disks. - :paramtype custom_persistent_disks: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskResource] - :keyword enable_end_to_end_tls: Indicate if end to end TLS is enabled. - :paramtype enable_end_to_end_tls: bool - :keyword loaded_certificates: Collection of loaded certificates. - :paramtype loaded_certificates: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LoadedCertificate] - :keyword vnet_addons: Additional App settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppVNetAddons - """ - super(AppResourceProperties, self).__init__(**kwargs) - self.public = public - self.url = None - self.addon_configs = addon_configs - self.provisioning_state = None - self.fqdn = fqdn - self.https_only = https_only - self.temporary_disk = temporary_disk - self.persistent_disk = persistent_disk - self.custom_persistent_disks = custom_persistent_disks - self.enable_end_to_end_tls = enable_end_to_end_tls - self.loaded_certificates = loaded_certificates - self.vnet_addons = vnet_addons - - -class AppVNetAddons(msrest.serialization.Model): - """Additional App settings in vnet injection instance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :vartype public_endpoint: bool - :ivar public_endpoint_url: URL of the App in vnet injection instance which could be accessed - from internet. - :vartype public_endpoint_url: str - """ - - _validation = { - 'public_endpoint_url': {'readonly': True}, - } - - _attribute_map = { - 'public_endpoint': {'key': 'publicEndpoint', 'type': 'bool'}, - 'public_endpoint_url': {'key': 'publicEndpointUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - public_endpoint: Optional[bool] = False, - **kwargs - ): - """ - :keyword public_endpoint: Indicates whether the App in vnet injection instance exposes endpoint - which could be accessed from internet. - :paramtype public_endpoint: bool - """ - super(AppVNetAddons, self).__init__(**kwargs) - self.public_endpoint = public_endpoint - self.public_endpoint_url = None - - -class AvailableOperations(msrest.serialization.Model): - """Available operations of the service. - - :ivar value: Collection of available operation details. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationDetail] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["OperationDetail"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of available operation details. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationDetail] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(AvailableOperations, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailableRuntimeVersions(msrest.serialization.Model): - """AvailableRuntimeVersions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of all supported runtime versions. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeVersion] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SupportedRuntimeVersion]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(AvailableRuntimeVersions, self).__init__(**kwargs) - self.value = None - - -class CustomPersistentDiskProperties(msrest.serialization.Model): - """Custom persistent disk resource payload. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AzureFileVolume. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.Type - :ivar mount_path: Required. The mount path of the persistent disk. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - """ - - _validation = { - 'type': {'required': True}, - 'mount_path': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'read_only': {'key': 'readOnly', 'type': 'bool'}, - 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, - } - - _subtype_map = { - 'type': {'AzureFileVolume': 'AzureFileVolume'} - } - - def __init__( - self, - *, - mount_path: str, - read_only: Optional[bool] = None, - mount_options: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword mount_path: Required. The mount path of the persistent disk. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - """ - super(CustomPersistentDiskProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.mount_path = mount_path - self.read_only = read_only - self.mount_options = mount_options - - -class AzureFileVolume(CustomPersistentDiskProperties): - """The properties of the Azure File volume. Azure File shares are mounted as volumes. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the underlying resource to mount as a persistent - disk.Constant filled by server. Possible values include: "AzureFileVolume". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.Type - :ivar mount_path: Required. The mount path of the persistent disk. - :vartype mount_path: str - :ivar read_only: Indicates whether the persistent disk is a readOnly one. - :vartype read_only: bool - :ivar mount_options: These are the mount options for a persistent disk. - :vartype mount_options: list[str] - :ivar share_name: Required. The share name of the Azure File share. - :vartype share_name: str - """ - - _validation = { - 'type': {'required': True}, - 'mount_path': {'required': True}, - 'share_name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - 'read_only': {'key': 'readOnly', 'type': 'bool'}, - 'mount_options': {'key': 'mountOptions', 'type': '[str]'}, - 'share_name': {'key': 'shareName', 'type': 'str'}, - } - - def __init__( - self, - *, - mount_path: str, - share_name: str, - read_only: Optional[bool] = None, - mount_options: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword mount_path: Required. The mount path of the persistent disk. - :paramtype mount_path: str - :keyword read_only: Indicates whether the persistent disk is a readOnly one. - :paramtype read_only: bool - :keyword mount_options: These are the mount options for a persistent disk. - :paramtype mount_options: list[str] - :keyword share_name: Required. The share name of the Azure File share. - :paramtype share_name: str - """ - super(AzureFileVolume, self).__init__(mount_path=mount_path, read_only=read_only, mount_options=mount_options, **kwargs) - self.type = 'AzureFileVolume' # type: str - self.share_name = share_name - - -class BindingResource(ProxyResource): - """Binding resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the Binding resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceProperties - """ - - _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': 'BindingResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BindingResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Binding resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceProperties - """ - super(BindingResource, self).__init__(**kwargs) - self.properties = properties - - -class BindingResourceCollection(msrest.serialization.Model): - """Object that includes an array of Binding resources and a possible link for next set. - - :ivar value: Collection of Binding resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Binding resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BindingResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BindingResourceProperties(msrest.serialization.Model): - """Binding resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_name: The name of the bound resource. - :vartype resource_name: str - :ivar resource_type: The standard Azure resource type of the bound resource. - :vartype resource_type: str - :ivar resource_id: The Azure resource id of the bound resource. - :vartype resource_id: str - :ivar key: The key of the bound resource. - :vartype key: str - :ivar binding_parameters: Binding parameters of the Binding resource. - :vartype binding_parameters: dict[str, any] - :ivar generated_properties: The generated Spring Boot property file for this binding. The - secret will be deducted. - :vartype generated_properties: str - :ivar created_at: Creation time of the Binding resource. - :vartype created_at: str - :ivar updated_at: Update time of the Binding resource. - :vartype updated_at: str - """ - - _validation = { - 'resource_name': {'readonly': True}, - 'resource_type': {'readonly': True}, - 'generated_properties': {'readonly': True}, - 'created_at': {'readonly': True}, - 'updated_at': {'readonly': True}, - } - - _attribute_map = { - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'binding_parameters': {'key': 'bindingParameters', 'type': '{object}'}, - 'generated_properties': {'key': 'generatedProperties', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'str'}, - 'updated_at': {'key': 'updatedAt', 'type': 'str'}, - } - - def __init__( - self, - *, - resource_id: Optional[str] = None, - key: Optional[str] = None, - binding_parameters: Optional[Dict[str, Any]] = None, - **kwargs - ): - """ - :keyword resource_id: The Azure resource id of the bound resource. - :paramtype resource_id: str - :keyword key: The key of the bound resource. - :paramtype key: str - :keyword binding_parameters: Binding parameters of the Binding resource. - :paramtype binding_parameters: dict[str, any] - """ - super(BindingResourceProperties, self).__init__(**kwargs) - self.resource_name = None - self.resource_type = None - self.resource_id = resource_id - self.key = key - self.binding_parameters = binding_parameters - self.generated_properties = None - self.created_at = None - self.updated_at = None - - -class Build(ProxyResource): - """Build resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildProperties - """ - - _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': 'BuildProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the build resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildProperties - """ - super(Build, self).__init__(**kwargs) - self.properties = properties - - -class BuildCollection(msrest.serialization.Model): - """Object that includes an array of Build resources and a possible link for next set. - - :ivar value: Collection of Build resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.Build] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Build]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["Build"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Build resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.Build] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuilderProperties(msrest.serialization.Model): - """KPack Builder properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Builder provision status. Possible values include: "Creating", - "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProvisioningState - :ivar stack: Builder cluster stack property. - :vartype stack: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StackProperties - :ivar buildpack_groups: Builder buildpack groups. - :vartype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpacksGroupProperties] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'stack': {'key': 'stack', 'type': 'StackProperties'}, - 'buildpack_groups': {'key': 'buildpackGroups', 'type': '[BuildpacksGroupProperties]'}, - } - - def __init__( - self, - *, - stack: Optional["StackProperties"] = None, - buildpack_groups: Optional[List["BuildpacksGroupProperties"]] = None, - **kwargs - ): - """ - :keyword stack: Builder cluster stack property. - :paramtype stack: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StackProperties - :keyword buildpack_groups: Builder buildpack groups. - :paramtype buildpack_groups: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpacksGroupProperties] - """ - super(BuilderProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.stack = stack - self.buildpack_groups = buildpack_groups - - -class BuilderResource(ProxyResource): - """KPack Builder 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Property of the Builder resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProperties - """ - - _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': 'BuilderProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuilderProperties"] = None, - **kwargs - ): - """ - :keyword properties: Property of the Builder resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderProperties - """ - super(BuilderResource, self).__init__(**kwargs) - self.properties = properties - - -class BuilderResourceCollection(msrest.serialization.Model): - """Object that includes an array of Builder resources and a possible link for next set. - - :ivar value: Collection of Builder resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuilderResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuilderResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Builder resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuilderResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackBindingLaunchProperties(msrest.serialization.Model): - """Buildpack Binding Launch Properties. - - :ivar properties: Non-sensitive properties for launchProperties. - :vartype properties: dict[str, str] - :ivar secrets: Sensitive properties for launchProperties. - :vartype secrets: dict[str, str] - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': '{str}'}, - 'secrets': {'key': 'secrets', 'type': '{str}'}, - } - - def __init__( - self, - *, - properties: Optional[Dict[str, str]] = None, - secrets: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword properties: Non-sensitive properties for launchProperties. - :paramtype properties: dict[str, str] - :keyword secrets: Sensitive properties for launchProperties. - :paramtype secrets: dict[str, str] - """ - super(BuildpackBindingLaunchProperties, self).__init__(**kwargs) - self.properties = properties - self.secrets = secrets - - -class BuildpackBindingProperties(msrest.serialization.Model): - """Properties of a buildpack binding. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". - :vartype binding_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingType - :ivar provisioning_state: State of the Buildpack Binding. Possible values include: "Creating", - "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProvisioningState - :ivar launch_properties: The object describes the buildpack binding launch properties. - :vartype launch_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingLaunchProperties - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'binding_type': {'key': 'bindingType', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'launch_properties': {'key': 'launchProperties', 'type': 'BuildpackBindingLaunchProperties'}, - } - - def __init__( - self, - *, - binding_type: Optional[Union[str, "BindingType"]] = None, - launch_properties: Optional["BuildpackBindingLaunchProperties"] = None, - **kwargs - ): - """ - :keyword binding_type: Buildpack Binding Type. Possible values include: "ApplicationInsights", - "ApacheSkyWalking", "AppDynamics", "Dynatrace", "NewRelic", "ElasticAPM". - :paramtype binding_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingType - :keyword launch_properties: The object describes the buildpack binding launch properties. - :paramtype launch_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingLaunchProperties - """ - super(BuildpackBindingProperties, self).__init__(**kwargs) - self.binding_type = binding_type - self.provisioning_state = None - self.launch_properties = launch_properties - - -class BuildpackBindingResource(ProxyResource): - """Buildpack Binding Resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of a buildpack binding. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProperties - """ - - _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': 'BuildpackBindingProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildpackBindingProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of a buildpack binding. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingProperties - """ - super(BuildpackBindingResource, self).__init__(**kwargs) - self.properties = properties - - -class BuildpackBindingResourceCollection(msrest.serialization.Model): - """Object that includes an array of BuildpackBinding resources and a possible link for next set. - - :ivar value: Collection of BuildpackBinding resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildpackBindingResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildpackBindingResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of BuildpackBinding resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildpackBindingResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildpackProperties(msrest.serialization.Model): - """Buildpack properties payload. - - :ivar id: Id of the buildpack. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: Id of the buildpack. - :paramtype id: str - """ - super(BuildpackProperties, self).__init__(**kwargs) - self.id = id - - -class BuildpacksGroupProperties(msrest.serialization.Model): - """Buildpack group properties of the Builder. - - :ivar name: Buildpack group name. - :vartype name: str - :ivar buildpacks: Buildpacks in the buildpack group. - :vartype buildpacks: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackProperties] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'buildpacks': {'key': 'buildpacks', 'type': '[BuildpackProperties]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - buildpacks: Optional[List["BuildpackProperties"]] = None, - **kwargs - ): - """ - :keyword name: Buildpack group name. - :paramtype name: str - :keyword buildpacks: Buildpacks in the buildpack group. - :paramtype buildpacks: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackProperties] - """ - super(BuildpacksGroupProperties, self).__init__(**kwargs) - self.name = name - self.buildpacks = buildpacks - - -class BuildProperties(msrest.serialization.Model): - """Build resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar relative_path: The relative path of source code. - :vartype relative_path: str - :ivar builder: The resource id of builder to build the source code. - :vartype builder: str - :ivar agent_pool: The resource id of agent pool. - :vartype agent_pool: str - :ivar provisioning_state: Provisioning state of the KPack build result. Possible values - include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildProvisioningState - :ivar env: The environment variables for this build. - :vartype env: dict[str, str] - :ivar triggered_build_result: The build result triggered by this build. - :vartype triggered_build_result: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.TriggeredBuildResult - :ivar resource_requests: The customized build resource for this build. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResourceRequests - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'triggered_build_result': {'readonly': True}, - } - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'builder': {'key': 'builder', 'type': 'str'}, - 'agent_pool': {'key': 'agentPool', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'env': {'key': 'env', 'type': '{str}'}, - 'triggered_build_result': {'key': 'triggeredBuildResult', 'type': 'TriggeredBuildResult'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'BuildResourceRequests'}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - builder: Optional[str] = None, - agent_pool: Optional[str] = None, - env: Optional[Dict[str, str]] = None, - resource_requests: Optional["BuildResourceRequests"] = None, - **kwargs - ): - """ - :keyword relative_path: The relative path of source code. - :paramtype relative_path: str - :keyword builder: The resource id of builder to build the source code. - :paramtype builder: str - :keyword agent_pool: The resource id of agent pool. - :paramtype agent_pool: str - :keyword env: The environment variables for this build. - :paramtype env: dict[str, str] - :keyword resource_requests: The customized build resource for this build. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResourceRequests - """ - super(BuildProperties, self).__init__(**kwargs) - self.relative_path = relative_path - self.builder = builder - self.agent_pool = agent_pool - self.provisioning_state = None - self.env = env - self.triggered_build_result = None - self.resource_requests = resource_requests - - -class BuildResourceRequests(msrest.serialization.Model): - """Resource request payload of Build Resource. - - :ivar cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :vartype cpu: str - :ivar memory: Optional Memory allocated to the build resource. 1 GB can be represented by 1Gi - or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :vartype memory: str - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - *, - cpu: Optional[str] = "1", - memory: Optional[str] = "2Gi", - **kwargs - ): - """ - :keyword cpu: Optional Cpu allocated to the build resource. 1 core can be represented by 1 or - 1000m. - The default value is 1, this should not exceed build service agent pool cpu size. - :paramtype cpu: str - :keyword memory: Optional Memory allocated to the build resource. 1 GB can be represented by - 1Gi or 1024Mi. - The default value is 2Gi, this should not exceed build service agent pool memory size. - :paramtype memory: str - """ - super(BuildResourceRequests, self).__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class BuildResult(ProxyResource): - """Build result resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the build result resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultProperties - """ - - _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': 'BuildResultProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildResultProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the build result resource. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultProperties - """ - super(BuildResult, self).__init__(**kwargs) - self.properties = properties - - -class BuildResultCollection(msrest.serialization.Model): - """Object that includes an array of Build result resources and a possible link for next set. - - :ivar value: Collection of Build result resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildResult"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Build result resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildResultCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildResultLog(msrest.serialization.Model): - """Build result log resource properties payload. - - :ivar blob_url: The public download URL of this build result log. - :vartype blob_url: str - """ - - _attribute_map = { - 'blob_url': {'key': 'blobUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - blob_url: Optional[str] = None, - **kwargs - ): - """ - :keyword blob_url: The public download URL of this build result log. - :paramtype blob_url: str - """ - super(BuildResultLog, self).__init__(**kwargs) - self.blob_url = blob_url - - -class BuildResultProperties(msrest.serialization.Model): - """Build result resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of this build result. - :vartype name: str - :ivar provisioning_state: Provisioning state of the KPack build result. Possible values - include: "Queuing", "Building", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultProvisioningState - :ivar build_pod_name: The build pod name which can be used to get the build log streaming. - :vartype build_pod_name: str - :ivar build_stages: All of the build stage (init-container and container) resources in build - pod. - :vartype build_stages: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildStageProperties] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'build_stages': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'build_pod_name': {'key': 'buildPodName', 'type': 'str'}, - 'build_stages': {'key': 'buildStages', 'type': '[BuildStageProperties]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - build_pod_name: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The name of this build result. - :paramtype name: str - :keyword build_pod_name: The build pod name which can be used to get the build log streaming. - :paramtype build_pod_name: str - """ - super(BuildResultProperties, self).__init__(**kwargs) - self.name = name - self.provisioning_state = None - self.build_pod_name = build_pod_name - self.build_stages = None - - -class UserSourceInfo(msrest.serialization.Model): - """Source information for a deployment. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: BuildResultUserSourceInfo, CustomContainerUserSourceInfo, UploadedUserSourceInfo. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'BuildResult': 'BuildResultUserSourceInfo', 'Container': 'CustomContainerUserSourceInfo', 'UploadedUserSourceInfo': 'UploadedUserSourceInfo'} - } - - def __init__( - self, - *, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - """ - super(UserSourceInfo, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.version = version - - -class BuildResultUserSourceInfo(UserSourceInfo): - """Reference to a build result. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar build_result_id: Resource id of an existing succeeded build result under the same Spring - instance. - :vartype build_result_id: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'build_result_id': {'key': 'buildResultId', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - build_result_id: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword build_result_id: Resource id of an existing succeeded build result under the same - Spring instance. - :paramtype build_result_id: str - """ - super(BuildResultUserSourceInfo, self).__init__(version=version, **kwargs) - self.type = 'BuildResult' # type: str - self.build_result_id = build_result_id - - -class BuildService(ProxyResource): - """Build service resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the build resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProperties - """ - - _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': 'BuildServiceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildServiceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the build resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProperties - """ - super(BuildService, self).__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolProperties(msrest.serialization.Model): - """Build service agent pool properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the build service agent pool. - :vartype provisioning_state: str - :ivar pool_size: build service agent pool size properties. - :vartype pool_size: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'pool_size': {'key': 'poolSize', 'type': 'BuildServiceAgentPoolSizeProperties'}, - } - - def __init__( - self, - *, - pool_size: Optional["BuildServiceAgentPoolSizeProperties"] = None, - **kwargs - ): - """ - :keyword pool_size: build service agent pool size properties. - :paramtype pool_size: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolSizeProperties - """ - super(BuildServiceAgentPoolProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.pool_size = pool_size - - -class BuildServiceAgentPoolResource(ProxyResource): - """The build service agent pool 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: build service agent pool properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolProperties - """ - - _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': 'BuildServiceAgentPoolProperties'}, - } - - def __init__( - self, - *, - properties: Optional["BuildServiceAgentPoolProperties"] = None, - **kwargs - ): - """ - :keyword properties: build service agent pool properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolProperties - """ - super(BuildServiceAgentPoolResource, self).__init__(**kwargs) - self.properties = properties - - -class BuildServiceAgentPoolResourceCollection(msrest.serialization.Model): - """Object that includes an array of build service agent pool resources and a possible link for next set. - - :ivar value: Collection of build service agent pool resource. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildServiceAgentPoolResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildServiceAgentPoolResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of build service agent pool resource. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildServiceAgentPoolResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceAgentPoolSizeProperties(msrest.serialization.Model): - """Build service agent pool size properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of build service agent pool size. - :vartype name: str - :ivar cpu: The cpu property of build service agent pool size. - :vartype cpu: str - :ivar memory: The memory property of build service agent pool size. - :vartype memory: str - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - **kwargs - ): - """ - :keyword name: The name of build service agent pool size. - :paramtype name: str - """ - super(BuildServiceAgentPoolSizeProperties, self).__init__(**kwargs) - self.name = name - self.cpu = None - self.memory = None - - -class BuildServiceCollection(msrest.serialization.Model): - """Object that includes an array of Build service resources and a possible link for next set. - - :ivar value: Collection of Build service resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BuildService]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["BuildService"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Build service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(BuildServiceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class BuildServiceProperties(msrest.serialization.Model): - """Build service resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar k_pack_version: The installed KPack version in this build service. - :vartype k_pack_version: str - :ivar provisioning_state: Provisioning state of the KPack build result. Possible values - include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceProvisioningState - :ivar resource_requests: The runtime resource configuration of this build service. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServicePropertiesResourceRequests - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'k_pack_version': {'key': 'kPackVersion', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'BuildServicePropertiesResourceRequests'}, - } - - def __init__( - self, - *, - k_pack_version: Optional[str] = None, - resource_requests: Optional["BuildServicePropertiesResourceRequests"] = None, - **kwargs - ): - """ - :keyword k_pack_version: The installed KPack version in this build service. - :paramtype k_pack_version: str - :keyword resource_requests: The runtime resource configuration of this build service. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServicePropertiesResourceRequests - """ - super(BuildServiceProperties, self).__init__(**kwargs) - self.k_pack_version = k_pack_version - self.provisioning_state = None - self.resource_requests = resource_requests - - -class BuildServicePropertiesResourceRequests(msrest.serialization.Model): - """The runtime resource configuration of this build service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: vCPU allocated to the entire build service node pool. - :vartype cpu: str - :ivar memory: Memory allocated to the entire build service node pool. - :vartype memory: str - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(BuildServicePropertiesResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - - -class BuildStageProperties(msrest.serialization.Model): - """The build stage (init-container and container) resources in build pod. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of this build stage resource. - :vartype name: str - :ivar status: The provisioning state of this build stage resource. Possible values include: - "NotStarted", "Running", "Succeeded", "Failed". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.KPackBuildStageProvisioningState - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(BuildStageProperties, self).__init__(**kwargs) - self.name = None - self.status = None - - -class CertificateProperties(msrest.serialization.Model): - """Certificate resource payload. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ContentCertificateProperties, KeyVaultCertificateProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar issuer: The issuer of certificate. - :vartype issuer: str - :ivar issued_date: The issue date of certificate. - :vartype issued_date: str - :ivar expiration_date: The expiration date of certificate. - :vartype expiration_date: str - :ivar activate_date: The activate date of certificate. - :vartype activate_date: str - :ivar subject_name: The subject name of certificate. - :vartype subject_name: str - :ivar dns_names: The domain list of certificate. - :vartype dns_names: list[str] - :ivar provisioning_state: Provisioning state of the Certificate. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState - """ - - _validation = { - 'type': {'required': True}, - 'thumbprint': {'readonly': True}, - 'issuer': {'readonly': True}, - 'issued_date': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'activate_date': {'readonly': True}, - 'subject_name': {'readonly': True}, - 'dns_names': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'issued_date': {'key': 'issuedDate', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'activate_date': {'key': 'activateDate', 'type': 'str'}, - 'subject_name': {'key': 'subjectName', 'type': 'str'}, - 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'ContentCertificate': 'ContentCertificateProperties', 'KeyVaultCertificate': 'KeyVaultCertificateProperties'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(CertificateProperties, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.thumbprint = None - self.issuer = None - self.issued_date = None - self.expiration_date = None - self.activate_date = None - self.subject_name = None - self.dns_names = None - self.provisioning_state = None - - -class CertificateResource(ProxyResource): - """Certificate resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the certificate resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateProperties - """ - - _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': 'CertificateProperties'}, - } - - def __init__( - self, - *, - properties: Optional["CertificateProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the certificate resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateProperties - """ - super(CertificateResource, self).__init__(**kwargs) - self.properties = properties - - -class CertificateResourceCollection(msrest.serialization.Model): - """Collection compose of certificate resources list and a possible link for next page. - - :ivar value: The certificate resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :ivar next_link: The link to next page of certificate list. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CertificateResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["CertificateResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The certificate resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :keyword next_link: The link to next page of certificate list. - :paramtype next_link: str - """ - super(CertificateResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :vartype code: str - :ivar message: A message describing the error, intended to be suitable for display in a user - interface. - :vartype message: str - :ivar target: The target of the particular error. For example, the name of the property in - error. - :vartype target: str - :ivar details: A list of additional details about the error. - :vartype details: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["CloudErrorBody"]] = None, - **kwargs - ): - """ - :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :paramtype code: str - :keyword message: A message describing the error, intended to be suitable for display in a user - interface. - :paramtype message: str - :keyword target: The target of the particular error. For example, the name of the property in - error. - :paramtype target: str - :keyword details: A list of additional details about the error. - :paramtype details: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CloudErrorBody] - """ - super(CloudErrorBody, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class ClusterResourceProperties(msrest.serialization.Model): - """Service properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of the Service. Possible values include: - "Creating", "Updating", "Starting", "Stopping", "Deleting", "Deleted", "Succeeded", "Failed", - "Moving", "Moved", "MoveFailed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProvisioningState - :ivar network_profile: Network profile of the Service. - :vartype network_profile: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfile - :ivar vnet_addons: Additional Service settings in vnet injection instance. - :vartype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceVNetAddons - :ivar version: Version of the Service. - :vartype version: int - :ivar service_id: ServiceInstanceEntity GUID which uniquely identifies a created resource. - :vartype service_id: str - :ivar power_state: Power state of the Service. Possible values include: "Running", "Stopped". - :vartype power_state: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.PowerState - :ivar zone_redundant: - :vartype zone_redundant: bool - :ivar fqdn: Fully qualified dns name of the service instance. - :vartype fqdn: str - :ivar marketplace_resource: Purchasing 3rd party product of the Service resource. - :vartype marketplace_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MarketplaceResource - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'version': {'readonly': True}, - 'service_id': {'readonly': True}, - 'power_state': {'readonly': True}, - 'fqdn': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfile'}, - 'vnet_addons': {'key': 'vnetAddons', 'type': 'ServiceVNetAddons'}, - 'version': {'key': 'version', 'type': 'int'}, - 'service_id': {'key': 'serviceId', 'type': 'str'}, - 'power_state': {'key': 'powerState', 'type': 'str'}, - 'zone_redundant': {'key': 'zoneRedundant', 'type': 'bool'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'marketplace_resource': {'key': 'marketplaceResource', 'type': 'MarketplaceResource'}, - } - - def __init__( - self, - *, - network_profile: Optional["NetworkProfile"] = None, - vnet_addons: Optional["ServiceVNetAddons"] = None, - zone_redundant: Optional[bool] = False, - marketplace_resource: Optional["MarketplaceResource"] = None, - **kwargs - ): - """ - :keyword network_profile: Network profile of the Service. - :paramtype network_profile: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfile - :keyword vnet_addons: Additional Service settings in vnet injection instance. - :paramtype vnet_addons: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceVNetAddons - :keyword zone_redundant: - :paramtype zone_redundant: bool - :keyword marketplace_resource: Purchasing 3rd party product of the Service resource. - :paramtype marketplace_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MarketplaceResource - """ - super(ClusterResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.network_profile = network_profile - self.vnet_addons = vnet_addons - self.version = None - self.service_id = None - self.power_state = None - self.zone_redundant = zone_redundant - self.fqdn = None - self.marketplace_resource = marketplace_resource - - -class ConfigServerGitProperty(msrest.serialization.Model): - """Property of git. - - All required parameters must be populated in order to send to Azure. - - :ivar repositories: Repositories of git. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GitPatternRepository] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool - """ - - _validation = { - 'uri': {'required': True}, - } - - _attribute_map = { - 'repositories': {'key': 'repositories', 'type': '[GitPatternRepository]'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'host_key': {'key': 'hostKey', 'type': 'str'}, - 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, - } - - def __init__( - self, - *, - uri: str, - repositories: Optional[List["GitPatternRepository"]] = None, - label: Optional[str] = None, - search_paths: Optional[List[str]] = None, - username: Optional[str] = None, - password: Optional[str] = None, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - strict_host_key_checking: Optional[bool] = None, - **kwargs - ): - """ - :keyword repositories: Repositories of git. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GitPatternRepository] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ - super(ConfigServerGitProperty, self).__init__(**kwargs) - self.repositories = repositories - self.uri = uri - self.label = label - self.search_paths = search_paths - self.username = username - self.password = password - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - self.strict_host_key_checking = strict_host_key_checking - - -class ConfigServerProperties(msrest.serialization.Model): - """Config server git properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the config server. Possible values include: "NotAvailable", - "Deleted", "Failed", "Succeeded", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerState - :ivar error: Error when apply config server settings. - :vartype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error - :ivar config_server: Settings of config server. - :vartype config_server: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'config_server': {'key': 'configServer', 'type': 'ConfigServerSettings'}, - } - - def __init__( - self, - *, - error: Optional["Error"] = None, - config_server: Optional["ConfigServerSettings"] = None, - **kwargs - ): - """ - :keyword error: Error when apply config server settings. - :paramtype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error - :keyword config_server: Settings of config server. - :paramtype config_server: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings - """ - super(ConfigServerProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.config_server = config_server - - -class ConfigServerResource(ProxyResource): - """Config Server 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the Config Server resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerProperties - """ - - _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': 'ConfigServerProperties'}, - } - - def __init__( - self, - *, - properties: Optional["ConfigServerProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Config Server resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerProperties - """ - super(ConfigServerResource, self).__init__(**kwargs) - self.properties = properties - - -class ConfigServerSettings(msrest.serialization.Model): - """The settings of config server. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerGitProperty - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigServerGitProperty'}, - } - - def __init__( - self, - *, - git_property: Optional["ConfigServerGitProperty"] = None, - **kwargs - ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerGitProperty - """ - super(ConfigServerSettings, self).__init__(**kwargs) - self.git_property = git_property - - -class ConfigServerSettingsErrorRecord(msrest.serialization.Model): - """Error record of the config server settings. - - :ivar name: The name of the config server settings error record. - :vartype name: str - :ivar uri: The uri of the config server settings error record. - :vartype uri: str - :ivar messages: The detail error messages of the record. - :vartype messages: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'messages': {'key': 'messages', 'type': '[str]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - uri: Optional[str] = None, - messages: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword name: The name of the config server settings error record. - :paramtype name: str - :keyword uri: The uri of the config server settings error record. - :paramtype uri: str - :keyword messages: The detail error messages of the record. - :paramtype messages: list[str] - """ - super(ConfigServerSettingsErrorRecord, self).__init__(**kwargs) - self.name = name - self.uri = uri - self.messages = messages - - -class ConfigServerSettingsValidateResult(msrest.serialization.Model): - """Validation result for config server settings. - - :ivar is_valid: Indicate if the config server settings are valid. - :vartype is_valid: bool - :ivar details: The detail validation results. - :vartype details: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsErrorRecord] - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'details': {'key': 'details', 'type': '[ConfigServerSettingsErrorRecord]'}, - } - - def __init__( - self, - *, - is_valid: Optional[bool] = None, - details: Optional[List["ConfigServerSettingsErrorRecord"]] = None, - **kwargs - ): - """ - :keyword is_valid: Indicate if the config server settings are valid. - :paramtype is_valid: bool - :keyword details: The detail validation results. - :paramtype details: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsErrorRecord] - """ - super(ConfigServerSettingsValidateResult, self).__init__(**kwargs) - self.is_valid = is_valid - self.details = details - - -class ConfigurationServiceGitProperty(msrest.serialization.Model): - """Property of git environment. - - :ivar repositories: Repositories of Application Configuration Service git property. - :vartype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitRepository] - """ - - _attribute_map = { - 'repositories': {'key': 'repositories', 'type': '[ConfigurationServiceGitRepository]'}, - } - - def __init__( - self, - *, - repositories: Optional[List["ConfigurationServiceGitRepository"]] = None, - **kwargs - ): - """ - :keyword repositories: Repositories of Application Configuration Service git property. - :paramtype repositories: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitRepository] - """ - super(ConfigurationServiceGitProperty, self).__init__(**kwargs) - self.repositories = repositories - - -class ConfigurationServiceGitPropertyValidateResult(msrest.serialization.Model): - """Validation result for configuration service settings. - - :ivar is_valid: Indicate if the configuration service settings are valid. - :vartype is_valid: bool - :ivar git_repos_validation_result: The detail validation results. - :vartype git_repos_validation_result: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ValidationMessages] - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'git_repos_validation_result': {'key': 'gitReposValidationResult', 'type': '[ValidationMessages]'}, - } - - def __init__( - self, - *, - is_valid: Optional[bool] = None, - git_repos_validation_result: Optional[List["ValidationMessages"]] = None, - **kwargs - ): - """ - :keyword is_valid: Indicate if the configuration service settings are valid. - :paramtype is_valid: bool - :keyword git_repos_validation_result: The detail validation results. - :paramtype git_repos_validation_result: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ValidationMessages] - """ - super(ConfigurationServiceGitPropertyValidateResult, self).__init__(**kwargs) - self.is_valid = is_valid - self.git_repos_validation_result = git_repos_validation_result - - -class ConfigurationServiceGitRepository(msrest.serialization.Model): - """Git repository property payload for Application Configuration Service. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar patterns: Required. Collection of patterns of the repository. - :vartype patterns: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Required. Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool - """ - - _validation = { - 'name': {'required': True}, - 'patterns': {'required': True}, - 'uri': {'required': True}, - 'label': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'patterns': {'key': 'patterns', 'type': '[str]'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'host_key': {'key': 'hostKey', 'type': 'str'}, - 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, - } - - def __init__( - self, - *, - name: str, - patterns: List[str], - uri: str, - label: str, - search_paths: Optional[List[str]] = None, - username: Optional[str] = None, - password: Optional[str] = None, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - strict_host_key_checking: Optional[bool] = None, - **kwargs - ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword patterns: Required. Collection of patterns of the repository. - :paramtype patterns: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Required. Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ - super(ConfigurationServiceGitRepository, self).__init__(**kwargs) - self.name = name - self.patterns = patterns - self.uri = uri - self.label = label - self.search_paths = search_paths - self.username = username - self.password = password - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - self.strict_host_key_checking = strict_host_key_checking - - -class ConfigurationServiceInstance(msrest.serialization.Model): - """Collection of instances belong to the Application Configuration Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Application Configuration Service instance. - :vartype name: str - :ivar status: Status of the Application Configuration Service instance. - :vartype status: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ConfigurationServiceInstance, self).__init__(**kwargs) - self.name = None - self.status = None - - -class ConfigurationServiceProperties(msrest.serialization.Model): - """Application Configuration Service properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Application Configuration Service. Possible values - include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResourceRequests - :ivar instances: Collection of instances belong to Application Configuration Service. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceInstance] - :ivar settings: The settings of Application Configuration Service. - :vartype settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'resource_requests': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'ConfigurationServiceResourceRequests'}, - 'instances': {'key': 'instances', 'type': '[ConfigurationServiceInstance]'}, - 'settings': {'key': 'settings', 'type': 'ConfigurationServiceSettings'}, - } - - def __init__( - self, - *, - settings: Optional["ConfigurationServiceSettings"] = None, - **kwargs - ): - """ - :keyword settings: The settings of Application Configuration Service. - :paramtype settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - """ - super(ConfigurationServiceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.resource_requests = None - self.instances = None - self.settings = settings - - -class ConfigurationServiceResource(ProxyResource): - """Application Configuration Service 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Application Configuration Service properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProperties - """ - - _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': 'ConfigurationServiceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["ConfigurationServiceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Application Configuration Service properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceProperties - """ - super(ConfigurationServiceResource, self).__init__(**kwargs) - self.properties = properties - - -class ConfigurationServiceResourceCollection(msrest.serialization.Model): - """Object that includes an array of configuration service resources and a possible link for next set. - - :ivar value: Collection of configuration service resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ConfigurationServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ConfigurationServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of configuration service resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ConfigurationServiceResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConfigurationServiceResourceRequests(msrest.serialization.Model): - """Resource request payload of Application Configuration Service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each Application Configuration Service instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Application Configuration Service instance. - :vartype memory: str - :ivar instance_count: Instance count of the Application Configuration Service. - :vartype instance_count: int - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - 'instance_count': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ConfigurationServiceResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class ConfigurationServiceSettings(msrest.serialization.Model): - """The settings of Application Configuration Service. - - :ivar git_property: Property of git environment. - :vartype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitProperty - """ - - _attribute_map = { - 'git_property': {'key': 'gitProperty', 'type': 'ConfigurationServiceGitProperty'}, - } - - def __init__( - self, - *, - git_property: Optional["ConfigurationServiceGitProperty"] = None, - **kwargs - ): - """ - :keyword git_property: Property of git environment. - :paramtype git_property: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitProperty - """ - super(ConfigurationServiceSettings, self).__init__(**kwargs) - self.git_property = git_property - - -class ConfigurationServiceSettingsValidateResult(msrest.serialization.Model): - """Validation result for configuration service settings. - - :ivar git_property_validation_result: Validation result for configuration service settings. - :vartype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - - _attribute_map = { - 'git_property_validation_result': {'key': 'gitPropertyValidationResult', 'type': 'ConfigurationServiceGitPropertyValidateResult'}, - } - - def __init__( - self, - *, - git_property_validation_result: Optional["ConfigurationServiceGitPropertyValidateResult"] = None, - **kwargs - ): - """ - :keyword git_property_validation_result: Validation result for configuration service settings. - :paramtype git_property_validation_result: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceGitPropertyValidateResult - """ - super(ConfigurationServiceSettingsValidateResult, self).__init__(**kwargs) - self.git_property_validation_result = git_property_validation_result - - -class ContainerProbeSettings(msrest.serialization.Model): - """Container liveness and readiness probe settings. - - :ivar disable_probe: Indicates whether disable the liveness and readiness probe. - :vartype disable_probe: bool - """ - - _attribute_map = { - 'disable_probe': {'key': 'disableProbe', 'type': 'bool'}, - } - - def __init__( - self, - *, - disable_probe: Optional[bool] = None, - **kwargs - ): - """ - :keyword disable_probe: Indicates whether disable the liveness and readiness probe. - :paramtype disable_probe: bool - """ - super(ContainerProbeSettings, self).__init__(**kwargs) - self.disable_probe = disable_probe - - -class ContentCertificateProperties(CertificateProperties): - """Properties of certificate imported from key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar issuer: The issuer of certificate. - :vartype issuer: str - :ivar issued_date: The issue date of certificate. - :vartype issued_date: str - :ivar expiration_date: The expiration date of certificate. - :vartype expiration_date: str - :ivar activate_date: The activate date of certificate. - :vartype activate_date: str - :ivar subject_name: The subject name of certificate. - :vartype subject_name: str - :ivar dns_names: The domain list of certificate. - :vartype dns_names: list[str] - :ivar provisioning_state: Provisioning state of the Certificate. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState - :ivar content: The content of uploaded certificate. - :vartype content: str - """ - - _validation = { - 'type': {'required': True}, - 'thumbprint': {'readonly': True}, - 'issuer': {'readonly': True}, - 'issued_date': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'activate_date': {'readonly': True}, - 'subject_name': {'readonly': True}, - 'dns_names': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'issued_date': {'key': 'issuedDate', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'activate_date': {'key': 'activateDate', 'type': 'str'}, - 'subject_name': {'key': 'subjectName', 'type': 'str'}, - 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'content': {'key': 'content', 'type': 'str'}, - } - - def __init__( - self, - *, - content: Optional[str] = None, - **kwargs - ): - """ - :keyword content: The content of uploaded certificate. - :paramtype content: str - """ - super(ContentCertificateProperties, self).__init__(**kwargs) - self.type = 'ContentCertificate' # type: str - self.content = content - - -class CustomContainer(msrest.serialization.Model): - """Custom container payload. - - :ivar server: The name of the registry that contains the container image. - :vartype server: str - :ivar container_image: Container image of the custom container. This should be in the form of - :code:``::code:`` without the server name of the registry. - :vartype container_image: str - :ivar command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT is - used if this is not provided. - :vartype command: list[str] - :ivar args: Arguments to the entrypoint. The docker image's CMD is used if this is not - provided. - :vartype args: list[str] - :ivar image_registry_credential: Credential of the image registry. - :vartype image_registry_credential: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ImageRegistryCredential - :ivar language_framework: Language framework of the container image uploaded. - :vartype language_framework: str - """ - - _attribute_map = { - 'server': {'key': 'server', 'type': 'str'}, - 'container_image': {'key': 'containerImage', 'type': 'str'}, - 'command': {'key': 'command', 'type': '[str]'}, - 'args': {'key': 'args', 'type': '[str]'}, - 'image_registry_credential': {'key': 'imageRegistryCredential', 'type': 'ImageRegistryCredential'}, - 'language_framework': {'key': 'languageFramework', 'type': 'str'}, - } - - def __init__( - self, - *, - server: Optional[str] = None, - container_image: Optional[str] = None, - command: Optional[List[str]] = None, - args: Optional[List[str]] = None, - image_registry_credential: Optional["ImageRegistryCredential"] = None, - language_framework: Optional[str] = None, - **kwargs - ): - """ - :keyword server: The name of the registry that contains the container image. - :paramtype server: str - :keyword container_image: Container image of the custom container. This should be in the form - of :code:``::code:`` without the server name of the registry. - :paramtype container_image: str - :keyword command: Entrypoint array. Not executed within a shell. The docker image's ENTRYPOINT - is used if this is not provided. - :paramtype command: list[str] - :keyword args: Arguments to the entrypoint. The docker image's CMD is used if this is not - provided. - :paramtype args: list[str] - :keyword image_registry_credential: Credential of the image registry. - :paramtype image_registry_credential: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ImageRegistryCredential - :keyword language_framework: Language framework of the container image uploaded. - :paramtype language_framework: str - """ - super(CustomContainer, self).__init__(**kwargs) - self.server = server - self.container_image = container_image - self.command = command - self.args = args - self.image_registry_credential = image_registry_credential - self.language_framework = language_framework - - -class CustomContainerUserSourceInfo(UserSourceInfo): - """Custom container user source info. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar custom_container: Custom container payload. - :vartype custom_container: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomContainer - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'custom_container': {'key': 'customContainer', 'type': 'CustomContainer'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - custom_container: Optional["CustomContainer"] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword custom_container: Custom container payload. - :paramtype custom_container: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomContainer - """ - super(CustomContainerUserSourceInfo, self).__init__(version=version, **kwargs) - self.type = 'Container' # type: str - self.custom_container = custom_container - - -class CustomDomainProperties(msrest.serialization.Model): - """Custom domain of app resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str - :ivar app_name: The app name of domain. - :vartype app_name: str - :ivar cert_name: The bound certificate name of domain. - :vartype cert_name: str - :ivar provisioning_state: Provisioning state of the Domain. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResourceProvisioningState - """ - - _validation = { - 'app_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'app_name': {'key': 'appName', 'type': 'str'}, - 'cert_name': {'key': 'certName', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - *, - thumbprint: Optional[str] = None, - cert_name: Optional[str] = None, - **kwargs - ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - :keyword cert_name: The bound certificate name of domain. - :paramtype cert_name: str - """ - super(CustomDomainProperties, self).__init__(**kwargs) - self.thumbprint = thumbprint - self.app_name = None - self.cert_name = cert_name - self.provisioning_state = None - - -class CustomDomainResource(ProxyResource): - """Custom domain resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the custom domain resource. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainProperties - """ - - _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': 'CustomDomainProperties'}, - } - - def __init__( - self, - *, - properties: Optional["CustomDomainProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the custom domain resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainProperties - """ - super(CustomDomainResource, self).__init__(**kwargs) - self.properties = properties - - -class CustomDomainResourceCollection(msrest.serialization.Model): - """Collection compose of a custom domain resources list and a possible link for next page. - - :ivar value: The custom domain resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :ivar next_link: The link to next page of custom domain list. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["CustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The custom domain resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :keyword next_link: The link to next page of custom domain list. - :paramtype next_link: str - """ - super(CustomDomainResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CustomDomainValidatePayload(msrest.serialization.Model): - """Custom domain validate payload. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. Name to be validated. - :vartype name: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - **kwargs - ): - """ - :keyword name: Required. Name to be validated. - :paramtype name: str - """ - super(CustomDomainValidatePayload, self).__init__(**kwargs) - self.name = name - - -class CustomDomainValidateResult(msrest.serialization.Model): - """Validation result for custom domain. - - :ivar is_valid: Indicates if domain name is valid. - :vartype is_valid: bool - :ivar message: Message of why domain name is invalid. - :vartype message: str - """ - - _attribute_map = { - 'is_valid': {'key': 'isValid', 'type': 'bool'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - is_valid: Optional[bool] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword is_valid: Indicates if domain name is valid. - :paramtype is_valid: bool - :keyword message: Message of why domain name is invalid. - :paramtype message: str - """ - super(CustomDomainValidateResult, self).__init__(**kwargs) - self.is_valid = is_valid - self.message = message - - -class CustomPersistentDiskResource(msrest.serialization.Model): - """Custom persistent disk resource payload. - - All required parameters must be populated in order to send to Azure. - - :ivar custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :vartype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskProperties - :ivar storage_id: Required. The resource id of Azure Spring Apps Storage resource. - :vartype storage_id: str - """ - - _validation = { - 'storage_id': {'required': True}, - } - - _attribute_map = { - 'custom_persistent_disk_properties': {'key': 'customPersistentDiskProperties', 'type': 'CustomPersistentDiskProperties'}, - 'storage_id': {'key': 'storageId', 'type': 'str'}, - } - - def __init__( - self, - *, - storage_id: str, - custom_persistent_disk_properties: Optional["CustomPersistentDiskProperties"] = None, - **kwargs - ): - """ - :keyword custom_persistent_disk_properties: Properties of the custom persistent disk resource - payload. - :paramtype custom_persistent_disk_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomPersistentDiskProperties - :keyword storage_id: Required. The resource id of Azure Spring Apps Storage resource. - :paramtype storage_id: str - """ - super(CustomPersistentDiskResource, self).__init__(**kwargs) - self.custom_persistent_disk_properties = custom_persistent_disk_properties - self.storage_id = storage_id - - -class DeploymentInstance(msrest.serialization.Model): - """Deployment instance payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the deployment instance. - :vartype name: str - :ivar status: Status of the deployment instance. - :vartype status: str - :ivar reason: Failed reason of the deployment instance. - :vartype reason: str - :ivar discovery_status: Discovery status of the deployment instance. - :vartype discovery_status: str - :ivar start_time: Start time of the deployment instance. - :vartype start_time: str - :ivar zone: Availability zone information of the deployment instance. - :vartype zone: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'reason': {'readonly': True}, - 'discovery_status': {'readonly': True}, - 'start_time': {'readonly': True}, - 'zone': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'discovery_status': {'key': 'discoveryStatus', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'zone': {'key': 'zone', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(DeploymentInstance, self).__init__(**kwargs) - self.name = None - self.status = None - self.reason = None - self.discovery_status = None - self.start_time = None - self.zone = None - - -class DeploymentResource(ProxyResource): - """Deployment resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the Deployment resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProperties - :ivar sku: Sku of the Deployment resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - - _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': 'DeploymentResourceProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__( - self, - *, - properties: Optional["DeploymentResourceProperties"] = None, - sku: Optional["Sku"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Deployment resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProperties - :keyword sku: Sku of the Deployment resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super(DeploymentResource, self).__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class DeploymentResourceCollection(msrest.serialization.Model): - """Object that includes an array of App resources and a possible link for next set. - - :ivar value: Collection of Deployment resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeploymentResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["DeploymentResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Deployment resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(DeploymentResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class DeploymentResourceProperties(msrest.serialization.Model): - """Deployment resource properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar source: Uploaded source information of the deployment. - :vartype source: ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserSourceInfo - :ivar deployment_settings: Deployment settings of the Deployment. - :vartype deployment_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentSettings - :ivar provisioning_state: Provisioning state of the Deployment. Possible values include: - "Creating", "Updating", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceProvisioningState - :ivar status: Status of the Deployment. Possible values include: "Stopped", "Running". - :vartype status: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceStatus - :ivar active: Indicates whether the Deployment is active. - :vartype active: bool - :ivar instances: Collection of instances belong to the Deployment. - :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentInstance] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'source': {'key': 'source', 'type': 'UserSourceInfo'}, - 'deployment_settings': {'key': 'deploymentSettings', 'type': 'DeploymentSettings'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'active': {'key': 'active', 'type': 'bool'}, - 'instances': {'key': 'instances', 'type': '[DeploymentInstance]'}, - } - - def __init__( - self, - *, - source: Optional["UserSourceInfo"] = None, - deployment_settings: Optional["DeploymentSettings"] = None, - active: Optional[bool] = None, - **kwargs - ): - """ - :keyword source: Uploaded source information of the deployment. - :paramtype source: ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserSourceInfo - :keyword deployment_settings: Deployment settings of the Deployment. - :paramtype deployment_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentSettings - :keyword active: Indicates whether the Deployment is active. - :paramtype active: bool - """ - super(DeploymentResourceProperties, self).__init__(**kwargs) - self.source = source - self.deployment_settings = deployment_settings - self.provisioning_state = None - self.status = None - self.active = active - self.instances = None - - -class DeploymentSettings(msrest.serialization.Model): - """Deployment settings payload. - - :ivar resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :vartype resource_requests: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceRequests - :ivar environment_variables: Collection of environment variables. - :vartype environment_variables: dict[str, str] - :ivar addon_configs: Collection of addons. - :vartype addon_configs: dict[str, dict[str, any]] - :ivar liveness_probe: Periodic probe of App Instance liveness. App Instance will be restarted - if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype liveness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :ivar readiness_probe: Periodic probe of App Instance service readiness. App Instance will be - removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype readiness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :ivar startup_probe: StartupProbe indicates that the App Instance has successfully initialized. - If specified, no other probes are executed until this completes successfully. If this probe - fails, the Pod will be restarted, just as if the livenessProbe failed. This can be used to - provide different probe parameters at the beginning of a App Instance's lifecycle, when it - might take a long time to load data or warm a cache, than during steady-state operation. This - cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype startup_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :ivar termination_grace_period_seconds: Optional duration in seconds the App Instance needs to - terminate gracefully. May be decreased in delete request. Value must be non-negative integer. - The value zero indicates stop immediately via the kill signal (no opportunity to shut down). If - this value is nil, the default grace period will be used instead. The grace period is the - duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :vartype termination_grace_period_seconds: int - :ivar container_probe_settings: Container liveness and readiness probe settings. - :vartype container_probe_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ContainerProbeSettings - """ - - _attribute_map = { - 'resource_requests': {'key': 'resourceRequests', 'type': 'ResourceRequests'}, - 'environment_variables': {'key': 'environmentVariables', 'type': '{str}'}, - 'addon_configs': {'key': 'addonConfigs', 'type': '{{object}}'}, - 'liveness_probe': {'key': 'livenessProbe', 'type': 'Probe'}, - 'readiness_probe': {'key': 'readinessProbe', 'type': 'Probe'}, - 'startup_probe': {'key': 'startupProbe', 'type': 'Probe'}, - 'termination_grace_period_seconds': {'key': 'terminationGracePeriodSeconds', 'type': 'int'}, - 'container_probe_settings': {'key': 'containerProbeSettings', 'type': 'ContainerProbeSettings'}, - } - - def __init__( - self, - *, - resource_requests: Optional["ResourceRequests"] = None, - environment_variables: Optional[Dict[str, str]] = None, - addon_configs: Optional[Dict[str, Dict[str, Any]]] = None, - liveness_probe: Optional["Probe"] = None, - readiness_probe: Optional["Probe"] = None, - startup_probe: Optional["Probe"] = None, - termination_grace_period_seconds: Optional[int] = 90, - container_probe_settings: Optional["ContainerProbeSettings"] = None, - **kwargs - ): - """ - :keyword resource_requests: The requested resource quantity for required CPU and Memory. It is - recommended that using this field to represent the required CPU and Memory, the old field cpu - and memoryInGB will be deprecated later. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceRequests - :keyword environment_variables: Collection of environment variables. - :paramtype environment_variables: dict[str, str] - :keyword addon_configs: Collection of addons. - :paramtype addon_configs: dict[str, dict[str, any]] - :keyword liveness_probe: Periodic probe of App Instance liveness. App Instance will be - restarted if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype liveness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :keyword readiness_probe: Periodic probe of App Instance service readiness. App Instance will - be removed from service endpoints if the probe fails. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype readiness_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :keyword startup_probe: StartupProbe indicates that the App Instance has successfully - initialized. If specified, no other probes are executed until this completes successfully. If - this probe fails, the Pod will be restarted, just as if the livenessProbe failed. This can be - used to provide different probe parameters at the beginning of a App Instance's lifecycle, when - it might take a long time to load data or warm a cache, than during steady-state operation. - This cannot be updated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype startup_probe: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Probe - :keyword termination_grace_period_seconds: Optional duration in seconds the App Instance needs - to terminate gracefully. May be decreased in delete request. Value must be non-negative - integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut - down). If this value is nil, the default grace period will be used instead. The grace period is - the duration in seconds after the processes running in the App Instance are sent a termination - signal and the time when the processes are forcibly halted with a kill signal. Set this value - longer than the expected cleanup time for your process. Defaults to 90 seconds. - :paramtype termination_grace_period_seconds: int - :keyword container_probe_settings: Container liveness and readiness probe settings. - :paramtype container_probe_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ContainerProbeSettings - """ - super(DeploymentSettings, self).__init__(**kwargs) - self.resource_requests = resource_requests - self.environment_variables = environment_variables - self.addon_configs = addon_configs - self.liveness_probe = liveness_probe - self.readiness_probe = readiness_probe - self.startup_probe = startup_probe - self.termination_grace_period_seconds = termination_grace_period_seconds - self.container_probe_settings = container_probe_settings - - -class DiagnosticParameters(msrest.serialization.Model): - """Diagnostic parameters of diagnostic operations. - - :ivar app_instance: App instance name. - :vartype app_instance: str - :ivar file_path: Your target file path in your own BYOS. - :vartype file_path: str - :ivar duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :vartype duration: str - """ - - _attribute_map = { - 'app_instance': {'key': 'appInstance', 'type': 'str'}, - 'file_path': {'key': 'filePath', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'str'}, - } - - def __init__( - self, - *, - app_instance: Optional[str] = None, - file_path: Optional[str] = None, - duration: Optional[str] = None, - **kwargs - ): - """ - :keyword app_instance: App instance name. - :paramtype app_instance: str - :keyword file_path: Your target file path in your own BYOS. - :paramtype file_path: str - :keyword duration: Duration of your JFR. 1 min can be represented by 1m or 60s. - :paramtype duration: str - """ - super(DiagnosticParameters, self).__init__(**kwargs) - self.app_instance = app_instance - self.file_path = file_path - self.duration = duration - - -class Error(msrest.serialization.Model): - """The error code compose of code and message. - - :ivar code: The code of error. - :vartype code: str - :ivar message: The message of error. - :vartype message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword code: The code of error. - :paramtype code: str - :keyword message: The message of error. - :paramtype message: str - """ - super(Error, self).__init__(**kwargs) - self.code = code - self.message = message - - -class ProbeAction(msrest.serialization.Model): - """The action of the probe. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ExecAction, HTTPGetAction, TCPSocketAction. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the action to take to perform the health check.Constant - filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'ExecAction': 'ExecAction', 'HTTPGetAction': 'HTTPGetAction', 'TCPSocketAction': 'TCPSocketAction'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ProbeAction, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class ExecAction(ProbeAction): - """ExecAction describes a "run in container" action. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the action to take to perform the health check.Constant - filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - :ivar command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :vartype command: list[str] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'command': {'key': 'command', 'type': '[str]'}, - } - - def __init__( - self, - *, - command: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword command: Command is the command line to execute inside the container, the working - directory for the command is root ('/') in the container's filesystem. The command is not run - inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you - need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and - non-zero is unhealthy. - :paramtype command: list[str] - """ - super(ExecAction, self).__init__(**kwargs) - self.type = 'ExecAction' # type: str - self.command = command - - -class GatewayApiMetadataProperties(msrest.serialization.Model): - """API metadata property for Spring Cloud Gateway. - - :ivar title: Title describing the context of the APIs available on the Gateway instance - (default: ``Spring Cloud Gateway for K8S``\ ). - :vartype title: str - :ivar description: Detailed description of the APIs available on the Gateway instance (default: - ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). - :vartype description: str - :ivar documentation: Location of additional documentation for the APIs available on the Gateway - instance. - :vartype documentation: str - :ivar version: Version of APIs available on this Gateway instance (default: ``unspecified``\ ). - :vartype version: str - :ivar server_url: Base URL that API consumers will use to access APIs on the Gateway instance. - :vartype server_url: str - """ - - _attribute_map = { - 'title': {'key': 'title', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'documentation': {'key': 'documentation', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'server_url': {'key': 'serverUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - description: Optional[str] = None, - documentation: Optional[str] = None, - version: Optional[str] = None, - server_url: Optional[str] = None, - **kwargs - ): - """ - :keyword title: Title describing the context of the APIs available on the Gateway instance - (default: ``Spring Cloud Gateway for K8S``\ ). - :paramtype title: str - :keyword description: Detailed description of the APIs available on the Gateway instance - (default: ``Generated OpenAPI 3 document that describes the API routes configured.``\ ). - :paramtype description: str - :keyword documentation: Location of additional documentation for the APIs available on the - Gateway instance. - :paramtype documentation: str - :keyword version: Version of APIs available on this Gateway instance (default: ``unspecified``\ - ). - :paramtype version: str - :keyword server_url: Base URL that API consumers will use to access APIs on the Gateway - instance. - :paramtype server_url: str - """ - super(GatewayApiMetadataProperties, self).__init__(**kwargs) - self.title = title - self.description = description - self.documentation = documentation - self.version = version - self.server_url = server_url - - -class GatewayApiRoute(msrest.serialization.Model): - """API route config of the Spring Cloud Gateway. - - :ivar title: A title, will be applied to methods in the generated OpenAPI documentation. - :vartype title: str - :ivar description: A description, will be applied to methods in the generated OpenAPI - documentation. - :vartype description: str - :ivar uri: Full uri, will override ``appName``. - :vartype uri: str - :ivar sso_enabled: Enable sso validation. - :vartype sso_enabled: bool - :ivar token_relay: Pass currently-authenticated user's identity token to application service, - default is 'false'. - :vartype token_relay: bool - :ivar predicates: A number of conditions to evaluate a route for each request. Each predicate - may be evaluated against request headers and parameter values. All of the predicates associated - with a route must evaluate to true for the route to be matched to the request. - :vartype predicates: list[str] - :ivar filters: To modify the request before sending it to the target endpoint, or the received - response. - :vartype filters: list[str] - :ivar order: Route processing order. - :vartype order: int - :ivar tags: A set of tags. Classification tags, will be applied to methods in the generated - OpenAPI documentation. - :vartype tags: list[str] - """ - - _attribute_map = { - 'title': {'key': 'title', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'sso_enabled': {'key': 'ssoEnabled', 'type': 'bool'}, - 'token_relay': {'key': 'tokenRelay', 'type': 'bool'}, - 'predicates': {'key': 'predicates', 'type': '[str]'}, - 'filters': {'key': 'filters', 'type': '[str]'}, - 'order': {'key': 'order', 'type': 'int'}, - 'tags': {'key': 'tags', 'type': '[str]'}, - } - - def __init__( - self, - *, - title: Optional[str] = None, - description: Optional[str] = None, - uri: Optional[str] = None, - sso_enabled: Optional[bool] = None, - token_relay: Optional[bool] = None, - predicates: Optional[List[str]] = None, - filters: Optional[List[str]] = None, - order: Optional[int] = None, - tags: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword title: A title, will be applied to methods in the generated OpenAPI documentation. - :paramtype title: str - :keyword description: A description, will be applied to methods in the generated OpenAPI - documentation. - :paramtype description: str - :keyword uri: Full uri, will override ``appName``. - :paramtype uri: str - :keyword sso_enabled: Enable sso validation. - :paramtype sso_enabled: bool - :keyword token_relay: Pass currently-authenticated user's identity token to application - service, default is 'false'. - :paramtype token_relay: bool - :keyword predicates: A number of conditions to evaluate a route for each request. Each - predicate may be evaluated against request headers and parameter values. All of the predicates - associated with a route must evaluate to true for the route to be matched to the request. - :paramtype predicates: list[str] - :keyword filters: To modify the request before sending it to the target endpoint, or the - received response. - :paramtype filters: list[str] - :keyword order: Route processing order. - :paramtype order: int - :keyword tags: A set of tags. Classification tags, will be applied to methods in the generated - OpenAPI documentation. - :paramtype tags: list[str] - """ - super(GatewayApiRoute, self).__init__(**kwargs) - self.title = title - self.description = description - self.uri = uri - self.sso_enabled = sso_enabled - self.token_relay = token_relay - self.predicates = predicates - self.filters = filters - self.order = order - self.tags = tags - - -class GatewayCorsProperties(msrest.serialization.Model): - """Cross-Origin Resource Sharing property. - - :ivar allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :vartype allowed_origins: list[str] - :ivar allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` - allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. - :vartype allowed_methods: list[str] - :ivar allowed_headers: Allowed headers in cross-site requests. The special value ``*`` allows - actual requests to send any header. - :vartype allowed_headers: list[str] - :ivar max_age: How long, in seconds, the response from a pre-flight request can be cached by - clients. - :vartype max_age: int - :ivar allow_credentials: Whether user credentials are supported on cross-site requests. Valid - values: ``true``\ , ``false``. - :vartype allow_credentials: bool - :ivar exposed_headers: HTTP response headers to expose for cross-site requests. - :vartype exposed_headers: list[str] - """ - - _attribute_map = { - 'allowed_origins': {'key': 'allowedOrigins', 'type': '[str]'}, - 'allowed_methods': {'key': 'allowedMethods', 'type': '[str]'}, - 'allowed_headers': {'key': 'allowedHeaders', 'type': '[str]'}, - 'max_age': {'key': 'maxAge', 'type': 'int'}, - 'allow_credentials': {'key': 'allowCredentials', 'type': 'bool'}, - 'exposed_headers': {'key': 'exposedHeaders', 'type': '[str]'}, - } - - def __init__( - self, - *, - allowed_origins: Optional[List[str]] = None, - allowed_methods: Optional[List[str]] = None, - allowed_headers: Optional[List[str]] = None, - max_age: Optional[int] = None, - allow_credentials: Optional[bool] = None, - exposed_headers: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword allowed_origins: Allowed origins to make cross-site requests. The special value ``*`` - allows all domains. - :paramtype allowed_origins: list[str] - :keyword allowed_methods: Allowed HTTP methods on cross-site requests. The special value ``*`` - allows all methods. If not set, ``GET`` and ``HEAD`` are allowed by default. - :paramtype allowed_methods: list[str] - :keyword allowed_headers: Allowed headers in cross-site requests. The special value ``*`` - allows actual requests to send any header. - :paramtype allowed_headers: list[str] - :keyword max_age: How long, in seconds, the response from a pre-flight request can be cached by - clients. - :paramtype max_age: int - :keyword allow_credentials: Whether user credentials are supported on cross-site requests. - Valid values: ``true``\ , ``false``. - :paramtype allow_credentials: bool - :keyword exposed_headers: HTTP response headers to expose for cross-site requests. - :paramtype exposed_headers: list[str] - """ - super(GatewayCorsProperties, self).__init__(**kwargs) - self.allowed_origins = allowed_origins - self.allowed_methods = allowed_methods - self.allowed_headers = allowed_headers - self.max_age = max_age - self.allow_credentials = allow_credentials - self.exposed_headers = exposed_headers - - -class GatewayCustomDomainProperties(msrest.serialization.Model): - """The properties of custom domain for Spring Cloud Gateway. - - :ivar thumbprint: The thumbprint of bound certificate. - :vartype thumbprint: str - """ - - _attribute_map = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - } - - def __init__( - self, - *, - thumbprint: Optional[str] = None, - **kwargs - ): - """ - :keyword thumbprint: The thumbprint of bound certificate. - :paramtype thumbprint: str - """ - super(GatewayCustomDomainProperties, self).__init__(**kwargs) - self.thumbprint = thumbprint - - -class GatewayCustomDomainResource(ProxyResource): - """Custom domain of the Spring Cloud Gateway. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: The properties of custom domain for Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainProperties - """ - - _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': 'GatewayCustomDomainProperties'}, - } - - def __init__( - self, - *, - properties: Optional["GatewayCustomDomainProperties"] = None, - **kwargs - ): - """ - :keyword properties: The properties of custom domain for Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainProperties - """ - super(GatewayCustomDomainResource, self).__init__(**kwargs) - self.properties = properties - - -class GatewayCustomDomainResourceCollection(msrest.serialization.Model): - """Object that includes an array of Spring Cloud Gateway custom domain resources and a possible link for next set. - - :ivar value: Collection of Spring Cloud Gateway custom domain resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GatewayCustomDomainResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["GatewayCustomDomainResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Spring Cloud Gateway custom domain resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(GatewayCustomDomainResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayInstance(msrest.serialization.Model): - """Collection of instances belong to the Spring Cloud Gateway. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Spring Cloud Gateway instance. - :vartype name: str - :ivar status: Status of the Spring Cloud Gateway instance. - :vartype status: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(GatewayInstance, self).__init__(**kwargs) - self.name = None - self.status = None - - -class GatewayOperatorProperties(msrest.serialization.Model): - """Properties of the Spring Cloud Gateway Operator. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayOperatorResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway operator. - :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayInstance] - """ - - _validation = { - 'resource_requests': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'resource_requests': {'key': 'resourceRequests', 'type': 'GatewayOperatorResourceRequests'}, - 'instances': {'key': 'instances', 'type': '[GatewayInstance]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(GatewayOperatorProperties, self).__init__(**kwargs) - self.resource_requests = None - self.instances = None - - -class GatewayOperatorResourceRequests(msrest.serialization.Model): - """Properties of the Spring Cloud Gateway Operator. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each Spring Cloud Gateway Operator instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Spring Cloud Gateway Operator instance. - :vartype memory: str - :ivar instance_count: Instance count of the Spring Cloud Gateway Operator. - :vartype instance_count: int - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - 'instance_count': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(GatewayOperatorResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class GatewayProperties(msrest.serialization.Model): - """Spring Cloud Gateway properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Spring Cloud Gateway. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProvisioningState - :ivar public: Indicates whether the Spring Cloud Gateway exposes endpoint. - :vartype public: bool - :ivar url: URL of the Spring Cloud Gateway, exposed when 'public' is true. - :vartype url: str - :ivar https_only: Indicate if only https is allowed. - :vartype https_only: bool - :ivar sso_properties: Single sign-on related configuration. - :vartype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties - :ivar api_metadata_properties: API metadata property for Spring Cloud Gateway. - :vartype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiMetadataProperties - :ivar cors_properties: Cross-Origin Resource Sharing property. - :vartype cors_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCorsProperties - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceRequests - :ivar instances: Collection of instances belong to Spring Cloud Gateway. - :vartype instances: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayInstance] - :ivar operator_properties: Properties of the Spring Cloud Gateway Operator. - :vartype operator_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayOperatorProperties - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'url': {'readonly': True}, - 'instances': {'readonly': True}, - 'operator_properties': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'public': {'key': 'public', 'type': 'bool'}, - 'url': {'key': 'url', 'type': 'str'}, - 'https_only': {'key': 'httpsOnly', 'type': 'bool'}, - 'sso_properties': {'key': 'ssoProperties', 'type': 'SsoProperties'}, - 'api_metadata_properties': {'key': 'apiMetadataProperties', 'type': 'GatewayApiMetadataProperties'}, - 'cors_properties': {'key': 'corsProperties', 'type': 'GatewayCorsProperties'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'GatewayResourceRequests'}, - 'instances': {'key': 'instances', 'type': '[GatewayInstance]'}, - 'operator_properties': {'key': 'operatorProperties', 'type': 'GatewayOperatorProperties'}, - } - - def __init__( - self, - *, - public: Optional[bool] = False, - https_only: Optional[bool] = False, - sso_properties: Optional["SsoProperties"] = None, - api_metadata_properties: Optional["GatewayApiMetadataProperties"] = None, - cors_properties: Optional["GatewayCorsProperties"] = None, - resource_requests: Optional["GatewayResourceRequests"] = None, - **kwargs - ): - """ - :keyword public: Indicates whether the Spring Cloud Gateway exposes endpoint. - :paramtype public: bool - :keyword https_only: Indicate if only https is allowed. - :paramtype https_only: bool - :keyword sso_properties: Single sign-on related configuration. - :paramtype sso_properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SsoProperties - :keyword api_metadata_properties: API metadata property for Spring Cloud Gateway. - :paramtype api_metadata_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiMetadataProperties - :keyword cors_properties: Cross-Origin Resource Sharing property. - :paramtype cors_properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCorsProperties - :keyword resource_requests: The requested resource quantity for required CPU and Memory. - :paramtype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceRequests - """ - super(GatewayProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.public = public - self.url = None - self.https_only = https_only - self.sso_properties = sso_properties - self.api_metadata_properties = api_metadata_properties - self.cors_properties = cors_properties - self.resource_requests = resource_requests - self.instances = None - self.operator_properties = None - - -class GatewayResource(ProxyResource): - """Spring Cloud Gateway 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Spring Cloud Gateway properties payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProperties - :ivar sku: Sku of the Spring Cloud Gateway resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - - _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': 'GatewayProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__( - self, - *, - properties: Optional["GatewayProperties"] = None, - sku: Optional["Sku"] = None, - **kwargs - ): - """ - :keyword properties: Spring Cloud Gateway properties payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProperties - :keyword sku: Sku of the Spring Cloud Gateway resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super(GatewayResource, self).__init__(**kwargs) - self.properties = properties - self.sku = sku - - -class GatewayResourceCollection(msrest.serialization.Model): - """Object that includes an array of gateway resources and a possible link for next set. - - :ivar value: Collection of gateway resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GatewayResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["GatewayResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of gateway resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(GatewayResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GatewayResourceRequests(msrest.serialization.Model): - """Resource request payload of Spring Cloud Gateway. - - :ivar cpu: Cpu allocated to each Spring Cloud Gateway instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Spring Cloud Gateway instance. - :vartype memory: str - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - *, - cpu: Optional[str] = None, - memory: Optional[str] = None, - **kwargs - ): - """ - :keyword cpu: Cpu allocated to each Spring Cloud Gateway instance. - :paramtype cpu: str - :keyword memory: Memory allocated to each Spring Cloud Gateway instance. - :paramtype memory: str - """ - super(GatewayResourceRequests, self).__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class GatewayRouteConfigOpenApiProperties(msrest.serialization.Model): - """OpenAPI properties of Spring Cloud Gateway route config. - - :ivar uri: The URI of OpenAPI specification. - :vartype uri: str - """ - - _attribute_map = { - 'uri': {'key': 'uri', 'type': 'str'}, - } - - def __init__( - self, - *, - uri: Optional[str] = None, - **kwargs - ): - """ - :keyword uri: The URI of OpenAPI specification. - :paramtype uri: str - """ - super(GatewayRouteConfigOpenApiProperties, self).__init__(**kwargs) - self.uri = uri - - -class GatewayRouteConfigProperties(msrest.serialization.Model): - """API route config of the Spring Cloud Gateway. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Spring Cloud Gateway route config. Possible values - include: "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayProvisioningState - :ivar app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :vartype app_resource_id: str - :ivar open_api: OpenAPI properties of Spring Cloud Gateway route config. - :vartype open_api: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :ivar routes: Array of API routes, each route contains properties such as ``title``\ , ``uri``\ - , ``ssoEnabled``\ , ``predicates``\ , ``filters``. - :vartype routes: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiRoute] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'app_resource_id': {'key': 'appResourceId', 'type': 'str'}, - 'open_api': {'key': 'openApi', 'type': 'GatewayRouteConfigOpenApiProperties'}, - 'routes': {'key': 'routes', 'type': '[GatewayApiRoute]'}, - } - - def __init__( - self, - *, - app_resource_id: Optional[str] = None, - open_api: Optional["GatewayRouteConfigOpenApiProperties"] = None, - routes: Optional[List["GatewayApiRoute"]] = None, - **kwargs - ): - """ - :keyword app_resource_id: The resource Id of the Azure Spring Apps app, required unless route - defines ``uri``. - :paramtype app_resource_id: str - :keyword open_api: OpenAPI properties of Spring Cloud Gateway route config. - :paramtype open_api: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigOpenApiProperties - :keyword routes: Array of API routes, each route contains properties such as ``title``\ , - ``uri``\ , ``ssoEnabled``\ , ``predicates``\ , ``filters``. - :paramtype routes: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayApiRoute] - """ - super(GatewayRouteConfigProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.app_resource_id = app_resource_id - self.open_api = open_api - self.routes = routes - - -class GatewayRouteConfigResource(ProxyResource): - """Spring Cloud Gateway route config 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: API route config of the Spring Cloud Gateway. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigProperties - """ - - _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': 'GatewayRouteConfigProperties'}, - } - - def __init__( - self, - *, - properties: Optional["GatewayRouteConfigProperties"] = None, - **kwargs - ): - """ - :keyword properties: API route config of the Spring Cloud Gateway. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigProperties - """ - super(GatewayRouteConfigResource, self).__init__(**kwargs) - self.properties = properties - - -class GatewayRouteConfigResourceCollection(msrest.serialization.Model): - """Object that includes an array of Spring Cloud Gateway route config resources and a possible link for next set. - - :ivar value: Collection of Spring Cloud Gateway route config resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GatewayRouteConfigResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["GatewayRouteConfigResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Spring Cloud Gateway route config resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(GatewayRouteConfigResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class GitPatternRepository(msrest.serialization.Model): - """Git repository property payload for config server. - - All required parameters must be populated in order to send to Azure. - - :ivar name: Required. Name of the repository. - :vartype name: str - :ivar pattern: Collection of pattern of the repository. - :vartype pattern: list[str] - :ivar uri: Required. URI of the repository. - :vartype uri: str - :ivar label: Label of the repository. - :vartype label: str - :ivar search_paths: Searching path of the repository. - :vartype search_paths: list[str] - :ivar username: Username of git repository basic auth. - :vartype username: str - :ivar password: Password of git repository basic auth. - :vartype password: str - :ivar host_key: Public sshKey of git repository. - :vartype host_key: str - :ivar host_key_algorithm: SshKey algorithm of git repository. - :vartype host_key_algorithm: str - :ivar private_key: Private sshKey algorithm of git repository. - :vartype private_key: str - :ivar strict_host_key_checking: Strict host key checking or not. - :vartype strict_host_key_checking: bool - """ - - _validation = { - 'name': {'required': True}, - 'uri': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'pattern': {'key': 'pattern', 'type': '[str]'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'search_paths': {'key': 'searchPaths', 'type': '[str]'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'host_key': {'key': 'hostKey', 'type': 'str'}, - 'host_key_algorithm': {'key': 'hostKeyAlgorithm', 'type': 'str'}, - 'private_key': {'key': 'privateKey', 'type': 'str'}, - 'strict_host_key_checking': {'key': 'strictHostKeyChecking', 'type': 'bool'}, - } - - def __init__( - self, - *, - name: str, - uri: str, - pattern: Optional[List[str]] = None, - label: Optional[str] = None, - search_paths: Optional[List[str]] = None, - username: Optional[str] = None, - password: Optional[str] = None, - host_key: Optional[str] = None, - host_key_algorithm: Optional[str] = None, - private_key: Optional[str] = None, - strict_host_key_checking: Optional[bool] = None, - **kwargs - ): - """ - :keyword name: Required. Name of the repository. - :paramtype name: str - :keyword pattern: Collection of pattern of the repository. - :paramtype pattern: list[str] - :keyword uri: Required. URI of the repository. - :paramtype uri: str - :keyword label: Label of the repository. - :paramtype label: str - :keyword search_paths: Searching path of the repository. - :paramtype search_paths: list[str] - :keyword username: Username of git repository basic auth. - :paramtype username: str - :keyword password: Password of git repository basic auth. - :paramtype password: str - :keyword host_key: Public sshKey of git repository. - :paramtype host_key: str - :keyword host_key_algorithm: SshKey algorithm of git repository. - :paramtype host_key_algorithm: str - :keyword private_key: Private sshKey algorithm of git repository. - :paramtype private_key: str - :keyword strict_host_key_checking: Strict host key checking or not. - :paramtype strict_host_key_checking: bool - """ - super(GitPatternRepository, self).__init__(**kwargs) - self.name = name - self.pattern = pattern - self.uri = uri - self.label = label - self.search_paths = search_paths - self.username = username - self.password = password - self.host_key = host_key - self.host_key_algorithm = host_key_algorithm - self.private_key = private_key - self.strict_host_key_checking = strict_host_key_checking - - -class HTTPGetAction(ProbeAction): - """HTTPGetAction describes an action based on HTTP Get requests. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the action to take to perform the health check.Constant - filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - :ivar path: Path to access on the HTTP server. - :vartype path: str - :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Possible values include: "HTTP", - "HTTPS". - :vartype scheme: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.HTTPSchemeType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'scheme': {'key': 'scheme', 'type': 'str'}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - scheme: Optional[Union[str, "HTTPSchemeType"]] = None, - **kwargs - ): - """ - :keyword path: Path to access on the HTTP server. - :paramtype path: str - :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. - - Possible enum values: - - - * ``"HTTP"`` means that the scheme used will be http:// - * ``"HTTPS"`` means that the scheme used will be https://. Possible values include: "HTTP", - "HTTPS". - :paramtype scheme: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.HTTPSchemeType - """ - super(HTTPGetAction, self).__init__(**kwargs) - self.type = 'HTTPGetAction' # type: str - self.path = path - self.scheme = scheme - - -class ImageRegistryCredential(msrest.serialization.Model): - """Credential of the image registry. - - :ivar username: The username of the image registry credential. - :vartype username: str - :ivar password: The password of the image registry credential. - :vartype password: str - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - *, - username: Optional[str] = None, - password: Optional[str] = None, - **kwargs - ): - """ - :keyword username: The username of the image registry credential. - :paramtype username: str - :keyword password: The password of the image registry credential. - :paramtype password: str - """ - super(ImageRegistryCredential, self).__init__(**kwargs) - self.username = username - self.password = password - - -class IngressConfig(msrest.serialization.Model): - """Ingress configuration payload for Azure Spring Apps resource. - - :ivar read_timeout_in_seconds: Ingress read time out in seconds. - :vartype read_timeout_in_seconds: int - """ - - _attribute_map = { - 'read_timeout_in_seconds': {'key': 'readTimeoutInSeconds', 'type': 'int'}, - } - - def __init__( - self, - *, - read_timeout_in_seconds: Optional[int] = None, - **kwargs - ): - """ - :keyword read_timeout_in_seconds: Ingress read time out in seconds. - :paramtype read_timeout_in_seconds: int - """ - super(IngressConfig, self).__init__(**kwargs) - self.read_timeout_in_seconds = read_timeout_in_seconds - - -class UploadedUserSourceInfo(UserSourceInfo): - """Source with uploaded location. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: JarUploadedUserSourceInfo, NetCoreZipUploadedUserSourceInfo, SourceUploadedUserSourceInfo. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Jar': 'JarUploadedUserSourceInfo', 'NetCoreZip': 'NetCoreZipUploadedUserSourceInfo', 'Source': 'SourceUploadedUserSourceInfo'} - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - """ - super(UploadedUserSourceInfo, self).__init__(version=version, **kwargs) - self.type = 'UploadedUserSourceInfo' # type: str - self.relative_path = relative_path - - -class JarUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Jar binary for a deployment. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar runtime_version: Runtime version of the Jar file. - :vartype runtime_version: str - :ivar jvm_options: JVM parameter. - :vartype jvm_options: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, - 'jvm_options': {'key': 'jvmOptions', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - runtime_version: Optional[str] = None, - jvm_options: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword runtime_version: Runtime version of the Jar file. - :paramtype runtime_version: str - :keyword jvm_options: JVM parameter. - :paramtype jvm_options: str - """ - super(JarUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) - self.type = 'Jar' # type: str - self.runtime_version = runtime_version - self.jvm_options = jvm_options - - -class KeyVaultCertificateProperties(CertificateProperties): - """Properties of certificate imported from key vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the certificate source.Constant filled by server. - :vartype type: str - :ivar thumbprint: The thumbprint of certificate. - :vartype thumbprint: str - :ivar issuer: The issuer of certificate. - :vartype issuer: str - :ivar issued_date: The issue date of certificate. - :vartype issued_date: str - :ivar expiration_date: The expiration date of certificate. - :vartype expiration_date: str - :ivar activate_date: The activate date of certificate. - :vartype activate_date: str - :ivar subject_name: The subject name of certificate. - :vartype subject_name: str - :ivar dns_names: The domain list of certificate. - :vartype dns_names: list[str] - :ivar provisioning_state: Provisioning state of the Certificate. Possible values include: - "Creating", "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceProvisioningState - :ivar vault_uri: Required. The vault uri of user key vault. - :vartype vault_uri: str - :ivar key_vault_cert_name: Required. The certificate name of key vault. - :vartype key_vault_cert_name: str - :ivar cert_version: The certificate version of key vault. - :vartype cert_version: str - :ivar exclude_private_key: Optional. If set to true, it will not import private key from key - vault. - :vartype exclude_private_key: bool - """ - - _validation = { - 'type': {'required': True}, - 'thumbprint': {'readonly': True}, - 'issuer': {'readonly': True}, - 'issued_date': {'readonly': True}, - 'expiration_date': {'readonly': True}, - 'activate_date': {'readonly': True}, - 'subject_name': {'readonly': True}, - 'dns_names': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'vault_uri': {'required': True}, - 'key_vault_cert_name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'issued_date': {'key': 'issuedDate', 'type': 'str'}, - 'expiration_date': {'key': 'expirationDate', 'type': 'str'}, - 'activate_date': {'key': 'activateDate', 'type': 'str'}, - 'subject_name': {'key': 'subjectName', 'type': 'str'}, - 'dns_names': {'key': 'dnsNames', 'type': '[str]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_vault_cert_name': {'key': 'keyVaultCertName', 'type': 'str'}, - 'cert_version': {'key': 'certVersion', 'type': 'str'}, - 'exclude_private_key': {'key': 'excludePrivateKey', 'type': 'bool'}, - } - - def __init__( - self, - *, - vault_uri: str, - key_vault_cert_name: str, - cert_version: Optional[str] = None, - exclude_private_key: Optional[bool] = False, - **kwargs - ): - """ - :keyword vault_uri: Required. The vault uri of user key vault. - :paramtype vault_uri: str - :keyword key_vault_cert_name: Required. The certificate name of key vault. - :paramtype key_vault_cert_name: str - :keyword cert_version: The certificate version of key vault. - :paramtype cert_version: str - :keyword exclude_private_key: Optional. If set to true, it will not import private key from key - vault. - :paramtype exclude_private_key: bool - """ - super(KeyVaultCertificateProperties, self).__init__(**kwargs) - self.type = 'KeyVaultCertificate' # type: str - self.vault_uri = vault_uri - self.key_vault_cert_name = key_vault_cert_name - self.cert_version = cert_version - self.exclude_private_key = exclude_private_key - - -class LoadedCertificate(msrest.serialization.Model): - """Loaded certificate payload. - - All required parameters must be populated in order to send to Azure. - - :ivar resource_id: Required. Resource Id of loaded certificate. - :vartype resource_id: str - :ivar load_trust_store: Indicate whether the certificate will be loaded into default trust - store, only work for Java runtime. - :vartype load_trust_store: bool - """ - - _validation = { - 'resource_id': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'load_trust_store': {'key': 'loadTrustStore', 'type': 'bool'}, - } - - def __init__( - self, - *, - resource_id: str, - load_trust_store: Optional[bool] = False, - **kwargs - ): - """ - :keyword resource_id: Required. Resource Id of loaded certificate. - :paramtype resource_id: str - :keyword load_trust_store: Indicate whether the certificate will be loaded into default trust - store, only work for Java runtime. - :paramtype load_trust_store: bool - """ - super(LoadedCertificate, self).__init__(**kwargs) - self.resource_id = resource_id - self.load_trust_store = load_trust_store - - -class LogFileUrlResponse(msrest.serialization.Model): - """Log file URL payload. - - All required parameters must be populated in order to send to Azure. - - :ivar url: Required. URL of the log file. - :vartype url: str - """ - - _validation = { - 'url': {'required': True}, - } - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - } - - def __init__( - self, - *, - url: str, - **kwargs - ): - """ - :keyword url: Required. URL of the log file. - :paramtype url: str - """ - super(LogFileUrlResponse, self).__init__(**kwargs) - self.url = url - - -class LogSpecification(msrest.serialization.Model): - """Specifications of the Log for Azure Monitoring. - - :ivar name: Name of the log. - :vartype name: str - :ivar display_name: Localized friendly display name of the log. - :vartype display_name: str - :ivar blob_duration: Blob duration of the log. - :vartype blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - blob_duration: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name of the log. - :paramtype name: str - :keyword display_name: Localized friendly display name of the log. - :paramtype display_name: str - :keyword blob_duration: Blob duration of the log. - :paramtype blob_duration: str - """ - super(LogSpecification, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class ManagedIdentityProperties(msrest.serialization.Model): - """Managed identity properties retrieved from ARM request headers. - - :ivar type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityType - :ivar principal_id: Principal Id of system-assigned managed identity. - :vartype principal_id: str - :ivar tenant_id: Tenant Id of system-assigned managed identity. - :vartype tenant_id: str - :ivar user_assigned_identities: Properties of user-assigned managed identities. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserAssignedManagedIdentity] - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedManagedIdentity}'}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "ManagedIdentityType"]] = None, - principal_id: Optional[str] = None, - tenant_id: Optional[str] = None, - user_assigned_identities: Optional[Dict[str, "UserAssignedManagedIdentity"]] = None, - **kwargs - ): - """ - :keyword type: Type of the managed identity. Possible values include: "None", "SystemAssigned", - "UserAssigned", "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ManagedIdentityType - :keyword principal_id: Principal Id of system-assigned managed identity. - :paramtype principal_id: str - :keyword tenant_id: Tenant Id of system-assigned managed identity. - :paramtype tenant_id: str - :keyword user_assigned_identities: Properties of user-assigned managed identities. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.appplatform.v2022_05_01_preview.models.UserAssignedManagedIdentity] - """ - super(ManagedIdentityProperties, self).__init__(**kwargs) - self.type = type - self.principal_id = principal_id - self.tenant_id = tenant_id - self.user_assigned_identities = user_assigned_identities - - -class MarketplaceResource(msrest.serialization.Model): - """Purchasing 3rd Party product for one Azure Spring Apps instance. - - :ivar plan: The plan id of the 3rd Party Artifact that is being procured. - :vartype plan: str - :ivar publisher: The publisher id of the 3rd Party Artifact that is being bought. - :vartype publisher: str - :ivar product: The 3rd Party artifact that is being procured. - :vartype product: str - """ - - _attribute_map = { - 'plan': {'key': 'plan', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - } - - def __init__( - self, - *, - plan: Optional[str] = None, - publisher: Optional[str] = None, - product: Optional[str] = None, - **kwargs - ): - """ - :keyword plan: The plan id of the 3rd Party Artifact that is being procured. - :paramtype plan: str - :keyword publisher: The publisher id of the 3rd Party Artifact that is being bought. - :paramtype publisher: str - :keyword product: The 3rd Party artifact that is being procured. - :paramtype product: str - """ - super(MarketplaceResource, self).__init__(**kwargs) - self.plan = plan - self.publisher = publisher - self.product = product - - -class MetricDimension(msrest.serialization.Model): - """Specifications of the Dimension of metrics. - - :ivar name: Name of the dimension. - :vartype name: str - :ivar display_name: Localized friendly display name of the dimension. - :vartype display_name: str - :ivar to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :vartype to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - to_be_exported_for_shoebox: Optional[bool] = None, - **kwargs - ): - """ - :keyword name: Name of the dimension. - :paramtype name: str - :keyword display_name: Localized friendly display name of the dimension. - :paramtype display_name: str - :keyword to_be_exported_for_shoebox: Whether this dimension should be included for the Shoebox - export scenario. - :paramtype to_be_exported_for_shoebox: bool - """ - super(MetricDimension, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.to_be_exported_for_shoebox = to_be_exported_for_shoebox - - -class MetricSpecification(msrest.serialization.Model): - """Specifications of the Metrics for Azure Monitoring. - - :ivar name: Name of the metric. - :vartype name: str - :ivar display_name: Localized friendly display name of the metric. - :vartype display_name: str - :ivar display_description: Localized friendly description of the metric. - :vartype display_description: str - :ivar unit: Unit that makes sense for the metric. - :vartype unit: str - :ivar category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :vartype category: str - :ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum, - Maximum, Total, Count. - :vartype aggregation_type: str - :ivar supported_aggregation_types: Supported aggregation types. - :vartype supported_aggregation_types: list[str] - :ivar supported_time_grain_types: Supported time grain types. - :vartype supported_time_grain_types: list[str] - :ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :vartype fill_gap_with_zero: bool - :ivar dimensions: Dimensions of the metric. - :vartype dimensions: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricDimension] - :ivar source_mdm_namespace: Name of the MDM namespace. Optional. - :vartype source_mdm_namespace: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'category': {'key': 'category', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display_name: Optional[str] = None, - display_description: Optional[str] = None, - unit: Optional[str] = None, - category: Optional[str] = None, - aggregation_type: Optional[str] = None, - supported_aggregation_types: Optional[List[str]] = None, - supported_time_grain_types: Optional[List[str]] = None, - fill_gap_with_zero: Optional[bool] = None, - dimensions: Optional[List["MetricDimension"]] = None, - source_mdm_namespace: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Name of the metric. - :paramtype name: str - :keyword display_name: Localized friendly display name of the metric. - :paramtype display_name: str - :keyword display_description: Localized friendly description of the metric. - :paramtype display_description: str - :keyword unit: Unit that makes sense for the metric. - :paramtype unit: str - :keyword category: Name of the metric category that the metric belongs to. A metric can only - belong to a single category. - :paramtype category: str - :keyword aggregation_type: Only provide one value for this field. Valid values: Average, - Minimum, Maximum, Total, Count. - :paramtype aggregation_type: str - :keyword supported_aggregation_types: Supported aggregation types. - :paramtype supported_aggregation_types: list[str] - :keyword supported_time_grain_types: Supported time grain types. - :paramtype supported_time_grain_types: list[str] - :keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time - duration where no metric is emitted/published. - :paramtype fill_gap_with_zero: bool - :keyword dimensions: Dimensions of the metric. - :paramtype dimensions: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricDimension] - :keyword source_mdm_namespace: Name of the MDM namespace. Optional. - :paramtype source_mdm_namespace: str - """ - super(MetricSpecification, self).__init__(**kwargs) - self.name = name - self.display_name = display_name - self.display_description = display_description - self.unit = unit - self.category = category - self.aggregation_type = aggregation_type - self.supported_aggregation_types = supported_aggregation_types - self.supported_time_grain_types = supported_time_grain_types - self.fill_gap_with_zero = fill_gap_with_zero - self.dimensions = dimensions - self.source_mdm_namespace = source_mdm_namespace - - -class MonitoringSettingProperties(msrest.serialization.Model): - """Monitoring Setting properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Monitoring Setting. Possible values include: - "NotAvailable", "Failed", "Succeeded", "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingState - :ivar error: Error when apply Monitoring Setting changes. - :vartype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error - :ivar trace_enabled: Indicates whether enable the trace functionality, which will be deprecated - since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey to indicate - if monitoringSettings enabled or not. - :vartype trace_enabled: bool - :ivar app_insights_instrumentation_key: Target application insight instrumentation key, null or - whitespace include empty will disable monitoringSettings. - :vartype app_insights_instrumentation_key: str - :ivar app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :vartype app_insights_sampling_rate: float - :ivar app_insights_agent_versions: Indicates the versions of application insight agent. - :vartype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApplicationInsightsAgentVersions - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'app_insights_sampling_rate': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'trace_enabled': {'key': 'traceEnabled', 'type': 'bool'}, - 'app_insights_instrumentation_key': {'key': 'appInsightsInstrumentationKey', 'type': 'str'}, - 'app_insights_sampling_rate': {'key': 'appInsightsSamplingRate', 'type': 'float'}, - 'app_insights_agent_versions': {'key': 'appInsightsAgentVersions', 'type': 'ApplicationInsightsAgentVersions'}, - } - - def __init__( - self, - *, - error: Optional["Error"] = None, - trace_enabled: Optional[bool] = None, - app_insights_instrumentation_key: Optional[str] = None, - app_insights_sampling_rate: Optional[float] = None, - app_insights_agent_versions: Optional["ApplicationInsightsAgentVersions"] = None, - **kwargs - ): - """ - :keyword error: Error when apply Monitoring Setting changes. - :paramtype error: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Error - :keyword trace_enabled: Indicates whether enable the trace functionality, which will be - deprecated since api version 2020-11-01-preview. Please leverage appInsightsInstrumentationKey - to indicate if monitoringSettings enabled or not. - :paramtype trace_enabled: bool - :keyword app_insights_instrumentation_key: Target application insight instrumentation key, null - or whitespace include empty will disable monitoringSettings. - :paramtype app_insights_instrumentation_key: str - :keyword app_insights_sampling_rate: Indicates the sampling rate of application insight agent, - should be in range [0.0, 100.0]. - :paramtype app_insights_sampling_rate: float - :keyword app_insights_agent_versions: Indicates the versions of application insight agent. - :paramtype app_insights_agent_versions: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApplicationInsightsAgentVersions - """ - super(MonitoringSettingProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.error = error - self.trace_enabled = trace_enabled - self.app_insights_instrumentation_key = app_insights_instrumentation_key - self.app_insights_sampling_rate = app_insights_sampling_rate - self.app_insights_agent_versions = app_insights_agent_versions - - -class MonitoringSettingResource(ProxyResource): - """Monitoring Setting 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the Monitoring Setting resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingProperties - """ - - _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': 'MonitoringSettingProperties'}, - } - - def __init__( - self, - *, - properties: Optional["MonitoringSettingProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the Monitoring Setting resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingProperties - """ - super(MonitoringSettingResource, self).__init__(**kwargs) - self.properties = properties - - -class NameAvailability(msrest.serialization.Model): - """Name availability result payload. - - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: Reason why the name is not available. - :vartype reason: str - :ivar message: Message why the name is not available. - :vartype message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - *, - name_available: Optional[bool] = None, - reason: Optional[str] = None, - message: Optional[str] = None, - **kwargs - ): - """ - :keyword name_available: Indicates whether the name is available. - :paramtype name_available: bool - :keyword reason: Reason why the name is not available. - :paramtype reason: str - :keyword message: Message why the name is not available. - :paramtype message: str - """ - super(NameAvailability, self).__init__(**kwargs) - self.name_available = name_available - self.reason = reason - self.message = message - - -class NameAvailabilityParameters(msrest.serialization.Model): - """Name availability parameters payload. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the resource to check name availability. - :vartype type: str - :ivar name: Required. Name to be checked. - :vartype name: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - *, - type: str, - name: str, - **kwargs - ): - """ - :keyword type: Required. Type of the resource to check name availability. - :paramtype type: str - :keyword name: Required. Name to be checked. - :paramtype name: str - """ - super(NameAvailabilityParameters, self).__init__(**kwargs) - self.type = type - self.name = name - - -class NetCoreZipUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Jar binary for a deployment. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar net_core_main_entry_path: The path to the .NET executable relative to zip root. - :vartype net_core_main_entry_path: str - :ivar runtime_version: Runtime version of the .Net file. - :vartype runtime_version: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'net_core_main_entry_path': {'key': 'netCoreMainEntryPath', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - net_core_main_entry_path: Optional[str] = None, - runtime_version: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword net_core_main_entry_path: The path to the .NET executable relative to zip root. - :paramtype net_core_main_entry_path: str - :keyword runtime_version: Runtime version of the .Net file. - :paramtype runtime_version: str - """ - super(NetCoreZipUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) - self.type = 'NetCoreZip' # type: str - self.net_core_main_entry_path = net_core_main_entry_path - self.runtime_version = runtime_version - - -class NetworkProfile(msrest.serialization.Model): - """Service network profile payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure Spring - Apps Service Runtime. - :vartype service_runtime_subnet_id: str - :ivar app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in Azure - Spring Apps. - :vartype app_subnet_id: str - :ivar service_cidr: Azure Spring Apps service reserved CIDR. - :vartype service_cidr: str - :ivar service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :vartype service_runtime_network_resource_group: str - :ivar app_network_resource_group: Name of the resource group containing network resources for - customer apps in Azure Spring Apps. - :vartype app_network_resource_group: str - :ivar outbound_i_ps: Desired outbound IP resources for Azure Spring Apps resource. - :vartype outbound_i_ps: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NetworkProfileOutboundIPs - :ivar required_traffics: Required inbound or outbound traffics for Azure Spring Apps resource. - :vartype required_traffics: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.RequiredTraffic] - :ivar ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :vartype ingress_config: ~azure.mgmt.appplatform.v2022_05_01_preview.models.IngressConfig - """ - - _validation = { - 'outbound_i_ps': {'readonly': True}, - 'required_traffics': {'readonly': True}, - } - - _attribute_map = { - 'service_runtime_subnet_id': {'key': 'serviceRuntimeSubnetId', 'type': 'str'}, - 'app_subnet_id': {'key': 'appSubnetId', 'type': 'str'}, - 'service_cidr': {'key': 'serviceCidr', 'type': 'str'}, - 'service_runtime_network_resource_group': {'key': 'serviceRuntimeNetworkResourceGroup', 'type': 'str'}, - 'app_network_resource_group': {'key': 'appNetworkResourceGroup', 'type': 'str'}, - 'outbound_i_ps': {'key': 'outboundIPs', 'type': 'NetworkProfileOutboundIPs'}, - 'required_traffics': {'key': 'requiredTraffics', 'type': '[RequiredTraffic]'}, - 'ingress_config': {'key': 'ingressConfig', 'type': 'IngressConfig'}, - } - - def __init__( - self, - *, - service_runtime_subnet_id: Optional[str] = None, - app_subnet_id: Optional[str] = None, - service_cidr: Optional[str] = None, - service_runtime_network_resource_group: Optional[str] = None, - app_network_resource_group: Optional[str] = None, - ingress_config: Optional["IngressConfig"] = None, - **kwargs - ): - """ - :keyword service_runtime_subnet_id: Fully qualified resource Id of the subnet to host Azure - Spring Apps Service Runtime. - :paramtype service_runtime_subnet_id: str - :keyword app_subnet_id: Fully qualified resource Id of the subnet to host customer apps in - Azure Spring Apps. - :paramtype app_subnet_id: str - :keyword service_cidr: Azure Spring Apps service reserved CIDR. - :paramtype service_cidr: str - :keyword service_runtime_network_resource_group: Name of the resource group containing network - resources of Azure Spring Apps Service Runtime. - :paramtype service_runtime_network_resource_group: str - :keyword app_network_resource_group: Name of the resource group containing network resources - for customer apps in Azure Spring Apps. - :paramtype app_network_resource_group: str - :keyword ingress_config: Ingress configuration payload for Azure Spring Apps resource. - :paramtype ingress_config: ~azure.mgmt.appplatform.v2022_05_01_preview.models.IngressConfig - """ - super(NetworkProfile, self).__init__(**kwargs) - self.service_runtime_subnet_id = service_runtime_subnet_id - self.app_subnet_id = app_subnet_id - self.service_cidr = service_cidr - self.service_runtime_network_resource_group = service_runtime_network_resource_group - self.app_network_resource_group = app_network_resource_group - self.outbound_i_ps = None - self.required_traffics = None - self.ingress_config = ingress_config - - -class NetworkProfileOutboundIPs(msrest.serialization.Model): - """Desired outbound IP resources for Azure Spring Apps resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_i_ps: A list of public IP addresses. - :vartype public_i_ps: list[str] - """ - - _validation = { - 'public_i_ps': {'readonly': True}, - } - - _attribute_map = { - 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(NetworkProfileOutboundIPs, self).__init__(**kwargs) - self.public_i_ps = None - - -class OperationDetail(msrest.serialization.Model): - """Operation detail payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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.appplatform.v2022_05_01_preview.models.OperationDisplay - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActionType - :ivar origin: Origin of the operation. - :vartype origin: str - :ivar properties: Properties of the operation. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationProperties - """ - - _validation = { - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["OperationDisplay"] = None, - origin: Optional[str] = None, - properties: Optional["OperationProperties"] = None, - **kwargs - ): - """ - :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.appplatform.v2022_05_01_preview.models.OperationDisplay - :keyword origin: Origin of the operation. - :paramtype origin: str - :keyword properties: Properties of the operation. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.OperationProperties - """ - super(OperationDetail, self).__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.action_type = None - self.origin = origin - self.properties = properties - - -class OperationDisplay(msrest.serialization.Model): - """Operation display payload. - - :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 = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - """ - :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(OperationDisplay, self).__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationProperties(msrest.serialization.Model): - """Extra Operation properties. - - :ivar service_specification: Service specifications of the operation. - :vartype service_specification: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - *, - service_specification: Optional["ServiceSpecification"] = None, - **kwargs - ): - """ - :keyword service_specification: Service specifications of the operation. - :paramtype service_specification: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceSpecification - """ - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = service_specification - - -class PersistentDisk(msrest.serialization.Model): - """Persistent disk payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size_in_gb: Size of the persistent disk in GB. - :vartype size_in_gb: int - :ivar used_in_gb: Size of the used persistent disk in GB. - :vartype used_in_gb: int - :ivar mount_path: Mount path of the persistent disk. - :vartype mount_path: str - """ - - _validation = { - 'size_in_gb': {'maximum': 50, 'minimum': 0}, - 'used_in_gb': {'readonly': True, 'maximum': 50, 'minimum': 0}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'used_in_gb': {'key': 'usedInGB', 'type': 'int'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - } - - def __init__( - self, - *, - size_in_gb: Optional[int] = None, - mount_path: Optional[str] = None, - **kwargs - ): - """ - :keyword size_in_gb: Size of the persistent disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the persistent disk. - :paramtype mount_path: str - """ - super(PersistentDisk, self).__init__(**kwargs) - self.size_in_gb = size_in_gb - self.used_in_gb = None - self.mount_path = mount_path - - -class Probe(msrest.serialization.Model): - """Probe describes a health check to be performed against an App Instance to determine whether it is alive or ready to receive traffic. - - All required parameters must be populated in order to send to Azure. - - :ivar probe_action: The action of the probe. - :vartype probe_action: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeAction - :ivar disable_probe: Required. Indicate whether the probe is disabled. - :vartype disable_probe: bool - :ivar initial_delay_seconds: Number of seconds after the App Instance has started before probes - are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :vartype initial_delay_seconds: int - :ivar period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :vartype period_seconds: int - :ivar timeout_seconds: Number of seconds after which the probe times out. Minimum value is 1. - :vartype timeout_seconds: int - :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :vartype failure_threshold: int - :ivar success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :vartype success_threshold: int - """ - - _validation = { - 'disable_probe': {'required': True}, - } - - _attribute_map = { - 'probe_action': {'key': 'probeAction', 'type': 'ProbeAction'}, - 'disable_probe': {'key': 'disableProbe', 'type': 'bool'}, - 'initial_delay_seconds': {'key': 'initialDelaySeconds', 'type': 'int'}, - 'period_seconds': {'key': 'periodSeconds', 'type': 'int'}, - 'timeout_seconds': {'key': 'timeoutSeconds', 'type': 'int'}, - 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, - 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, - } - - def __init__( - self, - *, - disable_probe: bool, - probe_action: Optional["ProbeAction"] = None, - initial_delay_seconds: Optional[int] = None, - period_seconds: Optional[int] = None, - timeout_seconds: Optional[int] = None, - failure_threshold: Optional[int] = None, - success_threshold: Optional[int] = None, - **kwargs - ): - """ - :keyword probe_action: The action of the probe. - :paramtype probe_action: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeAction - :keyword disable_probe: Required. Indicate whether the probe is disabled. - :paramtype disable_probe: bool - :keyword initial_delay_seconds: Number of seconds after the App Instance has started before - probes are initiated. More info: - https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes. - :paramtype initial_delay_seconds: int - :keyword period_seconds: How often (in seconds) to perform the probe. Minimum value is 1. - :paramtype period_seconds: int - :keyword timeout_seconds: Number of seconds after which the probe times out. Minimum value is - 1. - :paramtype timeout_seconds: int - :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed - after having succeeded. Minimum value is 1. - :paramtype failure_threshold: int - :keyword success_threshold: Minimum consecutive successes for the probe to be considered - successful after having failed. Must be 1 for liveness and startup. Minimum value is 1. - :paramtype success_threshold: int - """ - super(Probe, self).__init__(**kwargs) - self.probe_action = probe_action - self.disable_probe = disable_probe - self.initial_delay_seconds = initial_delay_seconds - self.period_seconds = period_seconds - self.timeout_seconds = timeout_seconds - self.failure_threshold = failure_threshold - self.success_threshold = success_threshold - - -class RegenerateTestKeyRequestPayload(msrest.serialization.Model): - """Regenerate test key request payload. - - All required parameters must be populated in order to send to Azure. - - :ivar key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :vartype key_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeyType - """ - - _validation = { - 'key_type': {'required': True}, - } - - _attribute_map = { - 'key_type': {'key': 'keyType', 'type': 'str'}, - } - - def __init__( - self, - *, - key_type: Union[str, "TestKeyType"], - **kwargs - ): - """ - :keyword key_type: Required. Type of the test key. Possible values include: "Primary", - "Secondary". - :paramtype key_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeyType - """ - super(RegenerateTestKeyRequestPayload, self).__init__(**kwargs) - self.key_type = key_type - - -class RequiredTraffic(msrest.serialization.Model): - """Required inbound or outbound traffic for Azure Spring Apps resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar protocol: The protocol of required traffic. - :vartype protocol: str - :ivar port: The port of required traffic. - :vartype port: int - :ivar ips: The ip list of required traffic. - :vartype ips: list[str] - :ivar fqdns: The FQDN list of required traffic. - :vartype fqdns: list[str] - :ivar direction: The direction of required traffic. Possible values include: "Inbound", - "Outbound". - :vartype direction: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.TrafficDirection - """ - - _validation = { - 'protocol': {'readonly': True}, - 'port': {'readonly': True}, - 'ips': {'readonly': True}, - 'fqdns': {'readonly': True}, - 'direction': {'readonly': True}, - } - - _attribute_map = { - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'ips': {'key': 'ips', 'type': '[str]'}, - 'fqdns': {'key': 'fqdns', 'type': '[str]'}, - 'direction': {'key': 'direction', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(RequiredTraffic, self).__init__(**kwargs) - self.protocol = None - self.port = None - self.ips = None - self.fqdns = None - self.direction = None - - -class ResourceRequests(msrest.serialization.Model): - """Deployment resource request payload. - - :ivar cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for - Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :vartype cpu: str - :ivar memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be {512Mi, - 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :vartype memory: str - """ - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - } - - def __init__( - self, - *, - cpu: Optional[str] = None, - memory: Optional[str] = None, - **kwargs - ): - """ - :keyword cpu: Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 - for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. - :paramtype cpu: str - :keyword memory: Required memory. 1 GB can be represented by 1Gi or 1024Mi. This should be - {512Mi, 1Gi, 2Gi} for Basic tier, and {512Mi, 1Gi, 2Gi, ..., 8Gi} for Standard tier. - :paramtype memory: str - """ - super(ResourceRequests, self).__init__(**kwargs) - self.cpu = cpu - self.memory = memory - - -class ResourceSku(msrest.serialization.Model): - """Describes an available Azure Spring Apps SKU. - - :ivar resource_type: Gets the type of resource the SKU applies to. - :vartype resource_type: str - :ivar name: Gets the name of SKU. - :vartype name: str - :ivar tier: Gets the tier of SKU. - :vartype tier: str - :ivar capacity: Gets the capacity of SKU. - :vartype capacity: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuCapacity - :ivar locations: Gets the set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Gets a list of locations and availability zones in those locations where - the SKU is available. - :vartype location_info: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuLocationInfo] - :ivar restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :vartype restrictions: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictions] - """ - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'SkuCapacity'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[ResourceSkuLocationInfo]'}, - 'restrictions': {'key': 'restrictions', 'type': '[ResourceSkuRestrictions]'}, - } - - def __init__( - self, - *, - resource_type: Optional[str] = None, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional["SkuCapacity"] = None, - locations: Optional[List[str]] = None, - location_info: Optional[List["ResourceSkuLocationInfo"]] = None, - restrictions: Optional[List["ResourceSkuRestrictions"]] = None, - **kwargs - ): - """ - :keyword resource_type: Gets the type of resource the SKU applies to. - :paramtype resource_type: str - :keyword name: Gets the name of SKU. - :paramtype name: str - :keyword tier: Gets the tier of SKU. - :paramtype tier: str - :keyword capacity: Gets the capacity of SKU. - :paramtype capacity: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuCapacity - :keyword locations: Gets the set of locations that the SKU is available. - :paramtype locations: list[str] - :keyword location_info: Gets a list of locations and availability zones in those locations - where the SKU is available. - :paramtype location_info: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuLocationInfo] - :keyword restrictions: Gets the restrictions because of which SKU cannot be used. This is - empty if there are no restrictions. - :paramtype restrictions: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictions] - """ - super(ResourceSku, self).__init__(**kwargs) - self.resource_type = resource_type - self.name = name - self.tier = tier - self.capacity = capacity - self.locations = locations - self.location_info = location_info - self.restrictions = restrictions - - -class ResourceSkuCapabilities(msrest.serialization.Model): - """ResourceSkuCapabilities. - - :ivar name: Gets an invariant to describe the feature. - :vartype name: str - :ivar value: Gets an invariant if the feature is measured by quantity. - :vartype value: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - value: Optional[str] = None, - **kwargs - ): - """ - :keyword name: Gets an invariant to describe the feature. - :paramtype name: str - :keyword value: Gets an invariant if the feature is measured by quantity. - :paramtype value: str - """ - super(ResourceSkuCapabilities, self).__init__(**kwargs) - self.name = name - self.value = value - - -class ResourceSkuCollection(msrest.serialization.Model): - """Object that includes an array of Azure Spring Apps SKU and a possible link for next set. - - :ivar value: Collection of resource SKU. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSku] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceSku]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ResourceSku"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of resource SKU. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSku] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ResourceSkuCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceSkuLocationInfo(msrest.serialization.Model): - """Locations and availability zones where the SKU is available. - - :ivar location: Gets location of the SKU. - :vartype location: str - :ivar zones: Gets list of availability zones where the SKU is supported. - :vartype zones: list[str] - :ivar zone_details: Gets details of capabilities available to a SKU in specific zones. - :vartype zone_details: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuZoneDetails] - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'zone_details': {'key': 'zoneDetails', 'type': '[ResourceSkuZoneDetails]'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - zones: Optional[List[str]] = None, - zone_details: Optional[List["ResourceSkuZoneDetails"]] = None, - **kwargs - ): - """ - :keyword location: Gets location of the SKU. - :paramtype location: str - :keyword zones: Gets list of availability zones where the SKU is supported. - :paramtype zones: list[str] - :keyword zone_details: Gets details of capabilities available to a SKU in specific zones. - :paramtype zone_details: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuZoneDetails] - """ - super(ResourceSkuLocationInfo, self).__init__(**kwargs) - self.location = location - self.zones = zones - self.zone_details = zone_details - - -class ResourceSkuRestrictionInfo(msrest.serialization.Model): - """Information about the restriction where the SKU cannot be used. - - :ivar locations: Gets locations where the SKU is restricted. - :vartype locations: list[str] - :ivar zones: Gets list of availability zones where the SKU is restricted. - :vartype zones: list[str] - """ - - _attribute_map = { - 'locations': {'key': 'locations', 'type': '[str]'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - *, - locations: Optional[List[str]] = None, - zones: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword locations: Gets locations where the SKU is restricted. - :paramtype locations: list[str] - :keyword zones: Gets list of availability zones where the SKU is restricted. - :paramtype zones: list[str] - """ - super(ResourceSkuRestrictionInfo, self).__init__(**kwargs) - self.locations = locations - self.zones = zones - - -class ResourceSkuRestrictions(msrest.serialization.Model): - """Restrictions where the SKU cannot be used. - - :ivar type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :vartype type: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsType - :ivar values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :vartype values: list[str] - :ivar restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :vartype restriction_info: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionInfo - :ivar reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :vartype reason_code: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'values': {'key': 'values', 'type': '[str]'}, - 'restriction_info': {'key': 'restrictionInfo', 'type': 'ResourceSkuRestrictionInfo'}, - 'reason_code': {'key': 'reasonCode', 'type': 'str'}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "ResourceSkuRestrictionsType"]] = None, - values: Optional[List[str]] = None, - restriction_info: Optional["ResourceSkuRestrictionInfo"] = None, - reason_code: Optional[Union[str, "ResourceSkuRestrictionsReasonCode"]] = None, - **kwargs - ): - """ - :keyword type: Gets the type of restrictions. Possible values include: 'Location', 'Zone'. - Possible values include: "Location", "Zone". - :paramtype type: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsType - :keyword values: Gets the value of restrictions. If the restriction type is set to - location. This would be different locations where the SKU is restricted. - :paramtype values: list[str] - :keyword restriction_info: Gets the information about the restriction where the SKU cannot be - used. - :paramtype restriction_info: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionInfo - :keyword reason_code: Gets the reason for restriction. Possible values include: 'QuotaId', - 'NotAvailableForSubscription'. Possible values include: "QuotaId", - "NotAvailableForSubscription". - :paramtype reason_code: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuRestrictionsReasonCode - """ - super(ResourceSkuRestrictions, self).__init__(**kwargs) - self.type = type - self.values = values - self.restriction_info = restriction_info - self.reason_code = reason_code - - -class ResourceSkuZoneDetails(msrest.serialization.Model): - """Details of capabilities available to a SKU in specific zones. - - :ivar name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :vartype name: list[str] - :ivar capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :vartype capabilities: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCapabilities] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': '[str]'}, - 'capabilities': {'key': 'capabilities', 'type': '[ResourceSkuCapabilities]'}, - } - - def __init__( - self, - *, - name: Optional[List[str]] = None, - capabilities: Optional[List["ResourceSkuCapabilities"]] = None, - **kwargs - ): - """ - :keyword name: Gets the set of zones that the SKU is available in with the - specified capabilities. - :paramtype name: list[str] - :keyword capabilities: Gets a list of capabilities that are available for the SKU in the - specified list of zones. - :paramtype capabilities: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCapabilities] - """ - super(ResourceSkuZoneDetails, self).__init__(**kwargs) - self.name = name - self.capabilities = capabilities - - -class ResourceUploadDefinition(msrest.serialization.Model): - """Resource upload definition payload. - - :ivar relative_path: Source relative path. - :vartype relative_path: str - :ivar upload_url: Upload URL. - :vartype upload_url: str - """ - - _attribute_map = { - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'upload_url': {'key': 'uploadUrl', 'type': 'str'}, - } - - def __init__( - self, - *, - relative_path: Optional[str] = None, - upload_url: Optional[str] = None, - **kwargs - ): - """ - :keyword relative_path: Source relative path. - :paramtype relative_path: str - :keyword upload_url: Upload URL. - :paramtype upload_url: str - """ - super(ResourceUploadDefinition, self).__init__(**kwargs) - self.relative_path = relative_path - self.upload_url = upload_url - - -class ServiceRegistryInstance(msrest.serialization.Model): - """Collection of instances belong to the Service Registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Service Registry instance. - :vartype name: str - :ivar status: Status of the Service Registry instance. - :vartype status: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ServiceRegistryInstance, self).__init__(**kwargs) - self.name = None - self.status = None - - -class ServiceRegistryProperties(msrest.serialization.Model): - """Service Registry properties payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: State of the Service Registry. Possible values include: "Creating", - "Updating", "Succeeded", "Failed", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProvisioningState - :ivar resource_requests: The requested resource quantity for required CPU and Memory. - :vartype resource_requests: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResourceRequests - :ivar instances: Collection of instances belong to Service Registry. - :vartype instances: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryInstance] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'resource_requests': {'readonly': True}, - 'instances': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'resource_requests': {'key': 'resourceRequests', 'type': 'ServiceRegistryResourceRequests'}, - 'instances': {'key': 'instances', 'type': '[ServiceRegistryInstance]'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ServiceRegistryProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.resource_requests = None - self.instances = None - - -class ServiceRegistryResource(ProxyResource): - """Service Registry 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Service Registry properties payload. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProperties - """ - - _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': 'ServiceRegistryProperties'}, - } - - def __init__( - self, - *, - properties: Optional["ServiceRegistryProperties"] = None, - **kwargs - ): - """ - :keyword properties: Service Registry properties payload. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryProperties - """ - super(ServiceRegistryResource, self).__init__(**kwargs) - self.properties = properties - - -class ServiceRegistryResourceCollection(msrest.serialization.Model): - """Object that includes an array of Service Registry resources and a possible link for next set. - - :ivar value: Collection of Service Registry resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceRegistryResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ServiceRegistryResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Service Registry resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ServiceRegistryResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceRegistryResourceRequests(msrest.serialization.Model): - """Resource request payload of Service Registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cpu: Cpu allocated to each Service Registry instance. - :vartype cpu: str - :ivar memory: Memory allocated to each Service Registry instance. - :vartype memory: str - :ivar instance_count: Instance count of the Service Registry. - :vartype instance_count: int - """ - - _validation = { - 'cpu': {'readonly': True}, - 'memory': {'readonly': True}, - 'instance_count': {'readonly': True}, - } - - _attribute_map = { - 'cpu': {'key': 'cpu', 'type': 'str'}, - 'memory': {'key': 'memory', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(ServiceRegistryResourceRequests, self).__init__(**kwargs) - self.cpu = None - self.memory = None - self.instance_count = None - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - **kwargs - ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - """ - super(TrackedResource, self).__init__(**kwargs) - self.location = location - self.tags = tags - - -class ServiceResource(TrackedResource): - """Service 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. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar location: The GEO location of the resource. - :vartype location: str - :ivar tags: A set of tags. Tags of the service which is a list of key value pairs that describe - the resource. - :vartype tags: dict[str, str] - :ivar properties: Properties of the Service resource. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ClusterResourceProperties - :ivar sku: Sku of the Service resource. - :vartype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - - _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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'ClusterResourceProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["ClusterResourceProperties"] = None, - sku: Optional["Sku"] = None, - **kwargs - ): - """ - :keyword location: The GEO location of the resource. - :paramtype location: str - :keyword tags: A set of tags. Tags of the service which is a list of key value pairs that - describe the resource. - :paramtype tags: dict[str, str] - :keyword properties: Properties of the Service resource. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ClusterResourceProperties - :keyword sku: Sku of the Service resource. - :paramtype sku: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Sku - """ - super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.sku = sku - - -class ServiceResourceList(msrest.serialization.Model): - """Object that includes an array of Service resources and a possible link for next set. - - :ivar value: Collection of Service resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["ServiceResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of Service resources. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(ServiceResourceList, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LogSpecification] - :ivar metric_specifications: Specifications of the Metrics for Azure Monitoring. - :vartype metric_specifications: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - *, - log_specifications: Optional[List["LogSpecification"]] = None, - metric_specifications: Optional[List["MetricSpecification"]] = None, - **kwargs - ): - """ - :keyword log_specifications: Specifications of the Log for Azure Monitoring. - :paramtype log_specifications: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.LogSpecification] - :keyword metric_specifications: Specifications of the Metrics for Azure Monitoring. - :paramtype metric_specifications: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.MetricSpecification] - """ - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = log_specifications - self.metric_specifications = metric_specifications - - -class ServiceVNetAddons(msrest.serialization.Model): - """Additional Service settings in vnet injection instance. - - :ivar log_stream_public_endpoint: Indicates whether the log stream in vnet injection instance - could be accessed from internet. - :vartype log_stream_public_endpoint: bool - """ - - _attribute_map = { - 'log_stream_public_endpoint': {'key': 'logStreamPublicEndpoint', 'type': 'bool'}, - } - - def __init__( - self, - *, - log_stream_public_endpoint: Optional[bool] = False, - **kwargs - ): - """ - :keyword log_stream_public_endpoint: Indicates whether the log stream in vnet injection - instance could be accessed from internet. - :paramtype log_stream_public_endpoint: bool - """ - super(ServiceVNetAddons, self).__init__(**kwargs) - self.log_stream_public_endpoint = log_stream_public_endpoint - - -class Sku(msrest.serialization.Model): - """Sku of Azure Spring Apps. - - :ivar name: Name of the Sku. - :vartype name: str - :ivar tier: Tier of the Sku. - :vartype tier: str - :ivar capacity: Current capacity of the target resource. - :vartype capacity: int - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - *, - name: Optional[str] = "S0", - tier: Optional[str] = "Standard", - capacity: Optional[int] = None, - **kwargs - ): - """ - :keyword name: Name of the Sku. - :paramtype name: str - :keyword tier: Tier of the Sku. - :paramtype tier: str - :keyword capacity: Current capacity of the target resource. - :paramtype capacity: int - """ - super(Sku, self).__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class SkuCapacity(msrest.serialization.Model): - """The SKU capacity. - - All required parameters must be populated in order to send to Azure. - - :ivar minimum: Required. Gets or sets the minimum. - :vartype minimum: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar default: Gets or sets the default. - :vartype default: int - :ivar scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :vartype scale_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuScaleType - """ - - _validation = { - 'minimum': {'required': True}, - } - - _attribute_map = { - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - 'default': {'key': 'default', 'type': 'int'}, - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - } - - def __init__( - self, - *, - minimum: int, - maximum: Optional[int] = None, - default: Optional[int] = None, - scale_type: Optional[Union[str, "SkuScaleType"]] = None, - **kwargs - ): - """ - :keyword minimum: Required. Gets or sets the minimum. - :paramtype minimum: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword default: Gets or sets the default. - :paramtype default: int - :keyword scale_type: Gets or sets the type of the scale. Possible values include: "None", - "Manual", "Automatic". - :paramtype scale_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SkuScaleType - """ - super(SkuCapacity, self).__init__(**kwargs) - self.minimum = minimum - self.maximum = maximum - self.default = default - self.scale_type = scale_type - - -class SourceUploadedUserSourceInfo(UploadedUserSourceInfo): - """Uploaded Java source code binary for a deployment. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. Type of the source uploaded.Constant filled by server. - :vartype type: str - :ivar version: Version of the source. - :vartype version: str - :ivar relative_path: Relative path of the storage which stores the source. - :vartype relative_path: str - :ivar artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :vartype artifact_selector: str - :ivar runtime_version: Runtime version of the source file. - :vartype runtime_version: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'relative_path': {'key': 'relativePath', 'type': 'str'}, - 'artifact_selector': {'key': 'artifactSelector', 'type': 'str'}, - 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, - } - - def __init__( - self, - *, - version: Optional[str] = None, - relative_path: Optional[str] = None, - artifact_selector: Optional[str] = None, - runtime_version: Optional[str] = None, - **kwargs - ): - """ - :keyword version: Version of the source. - :paramtype version: str - :keyword relative_path: Relative path of the storage which stores the source. - :paramtype relative_path: str - :keyword artifact_selector: Selector for the artifact to be used for the deployment for - multi-module projects. This should be - the relative path to the target module/project. - :paramtype artifact_selector: str - :keyword runtime_version: Runtime version of the source file. - :paramtype runtime_version: str - """ - super(SourceUploadedUserSourceInfo, self).__init__(version=version, relative_path=relative_path, **kwargs) - self.type = 'Source' # type: str - self.artifact_selector = artifact_selector - self.runtime_version = runtime_version - - -class SsoProperties(msrest.serialization.Model): - """Single sign-on related configuration. - - :ivar scope: It defines the specific actions applications can be allowed to do on a user's - behalf. - :vartype scope: list[str] - :ivar client_id: The public identifier for the application. - :vartype client_id: str - :ivar client_secret: The secret known only to the application and the authorization server. - :vartype client_secret: str - :ivar issuer_uri: The URI of Issuer Identifier. - :vartype issuer_uri: str - """ - - _attribute_map = { - 'scope': {'key': 'scope', 'type': '[str]'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'client_secret': {'key': 'clientSecret', 'type': 'str'}, - 'issuer_uri': {'key': 'issuerUri', 'type': 'str'}, - } - - def __init__( - self, - *, - scope: Optional[List[str]] = None, - client_id: Optional[str] = None, - client_secret: Optional[str] = None, - issuer_uri: Optional[str] = None, - **kwargs - ): - """ - :keyword scope: It defines the specific actions applications can be allowed to do on a user's - behalf. - :paramtype scope: list[str] - :keyword client_id: The public identifier for the application. - :paramtype client_id: str - :keyword client_secret: The secret known only to the application and the authorization server. - :paramtype client_secret: str - :keyword issuer_uri: The URI of Issuer Identifier. - :paramtype issuer_uri: str - """ - super(SsoProperties, self).__init__(**kwargs) - self.scope = scope - self.client_id = client_id - self.client_secret = client_secret - self.issuer_uri = issuer_uri - - -class StackProperties(msrest.serialization.Model): - """KPack ClusterStack properties payload. - - :ivar id: Id of the ClusterStack. - :vartype id: str - :ivar version: Version of the ClusterStack. - :vartype version: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword id: Id of the ClusterStack. - :paramtype id: str - :keyword version: Version of the ClusterStack. - :paramtype version: str - """ - super(StackProperties, self).__init__(**kwargs) - self.id = id - self.version = version - - -class StorageProperties(msrest.serialization.Model): - """Storage resource payload. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StorageAccount. - - All required parameters must be populated in order to send to Azure. - - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageType - """ - - _validation = { - 'storage_type': {'required': True}, - } - - _attribute_map = { - 'storage_type': {'key': 'storageType', 'type': 'str'}, - } - - _subtype_map = { - 'storage_type': {'StorageAccount': 'StorageAccount'} - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(StorageProperties, self).__init__(**kwargs) - self.storage_type = None # type: Optional[str] - - -class StorageAccount(StorageProperties): - """storage resource of type Azure Storage Account. - - All required parameters must be populated in order to send to Azure. - - :ivar storage_type: Required. The type of the storage.Constant filled by server. Possible - values include: "StorageAccount". - :vartype storage_type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageType - :ivar account_name: Required. The account name of the Azure Storage Account. - :vartype account_name: str - :ivar account_key: Required. The account key of the Azure Storage Account. - :vartype account_key: str - """ - - _validation = { - 'storage_type': {'required': True}, - 'account_name': {'required': True}, - 'account_key': {'required': True}, - } - - _attribute_map = { - 'storage_type': {'key': 'storageType', 'type': 'str'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'account_key': {'key': 'accountKey', 'type': 'str'}, - } - - def __init__( - self, - *, - account_name: str, - account_key: str, - **kwargs - ): - """ - :keyword account_name: Required. The account name of the Azure Storage Account. - :paramtype account_name: str - :keyword account_key: Required. The account key of the Azure Storage Account. - :paramtype account_key: str - """ - super(StorageAccount, self).__init__(**kwargs) - self.storage_type = 'StorageAccount' # type: str - self.account_name = account_name - self.account_key = account_key - - -class StorageResource(ProxyResource): - """Storage resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Properties of the storage resource payload. - :vartype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageProperties - """ - - _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': 'StorageProperties'}, - } - - def __init__( - self, - *, - properties: Optional["StorageProperties"] = None, - **kwargs - ): - """ - :keyword properties: Properties of the storage resource payload. - :paramtype properties: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageProperties - """ - super(StorageResource, self).__init__(**kwargs) - self.properties = properties - - -class StorageResourceCollection(msrest.serialization.Model): - """Collection compose of storage resources list and a possible link for next page. - - :ivar value: The storage resources list. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :ivar next_link: The link to next page of storage list. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["StorageResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The storage resources list. - :paramtype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :keyword next_link: The link to next page of storage list. - :paramtype next_link: str - """ - super(StorageResourceCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedBuildpackResource(ProxyResource): - """Supported buildpack resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Supported buildpack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResourceProperties - """ - - _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': 'SupportedBuildpackResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["SupportedBuildpackResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Supported buildpack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResourceProperties - """ - super(SupportedBuildpackResource, self).__init__(**kwargs) - self.properties = properties - - -class SupportedBuildpackResourceProperties(msrest.serialization.Model): - """Supported buildpack resource properties. - - :ivar buildpack_id: The id of supported buildpack. - :vartype buildpack_id: str - """ - - _attribute_map = { - 'buildpack_id': {'key': 'buildpackId', 'type': 'str'}, - } - - def __init__( - self, - *, - buildpack_id: Optional[str] = None, - **kwargs - ): - """ - :keyword buildpack_id: The id of supported buildpack. - :paramtype buildpack_id: str - """ - super(SupportedBuildpackResourceProperties, self).__init__(**kwargs) - self.buildpack_id = buildpack_id - - -class SupportedBuildpacksCollection(msrest.serialization.Model): - """Object that includes an array of supported buildpacks resources and a possible link for next set. - - :ivar value: Collection of supported buildpacks resources. - :vartype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SupportedBuildpackResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["SupportedBuildpackResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of supported buildpacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(SupportedBuildpacksCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SupportedRuntimeVersion(msrest.serialization.Model): - """Supported deployment runtime version descriptor. - - :ivar value: The raw value which could be passed to deployment CRUD operations. Possible values - include: "Java_8", "Java_11", "Java_17", "NetCore_31". - :vartype value: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeValue - :ivar platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :vartype platform: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimePlatform - :ivar version: The detailed version (major.minor) of the platform. - :vartype version: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'platform': {'key': 'platform', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[Union[str, "SupportedRuntimeValue"]] = None, - platform: Optional[Union[str, "SupportedRuntimePlatform"]] = None, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword value: The raw value which could be passed to deployment CRUD operations. Possible - values include: "Java_8", "Java_11", "Java_17", "NetCore_31". - :paramtype value: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimeValue - :keyword platform: The platform of this runtime version (possible values: "Java" or ".NET"). - Possible values include: "Java", ".NET Core". - :paramtype platform: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedRuntimePlatform - :keyword version: The detailed version (major.minor) of the platform. - :paramtype version: str - """ - super(SupportedRuntimeVersion, self).__init__(**kwargs) - self.value = value - self.platform = platform - self.version = version - - -class SupportedStackResource(ProxyResource): - """Supported stack resource payload. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SystemData - :ivar properties: Supported stack resource properties. - :vartype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResourceProperties - """ - - _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': 'SupportedStackResourceProperties'}, - } - - def __init__( - self, - *, - properties: Optional["SupportedStackResourceProperties"] = None, - **kwargs - ): - """ - :keyword properties: Supported stack resource properties. - :paramtype properties: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResourceProperties - """ - super(SupportedStackResource, self).__init__(**kwargs) - self.properties = properties - - -class SupportedStackResourceProperties(msrest.serialization.Model): - """Supported stack resource properties. - - :ivar stack_id: The id of supported stack. - :vartype stack_id: str - :ivar version: The version of supported stack. - :vartype version: str - """ - - _attribute_map = { - 'stack_id': {'key': 'stackId', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - *, - stack_id: Optional[str] = None, - version: Optional[str] = None, - **kwargs - ): - """ - :keyword stack_id: The id of supported stack. - :paramtype stack_id: str - :keyword version: The version of supported stack. - :paramtype version: str - """ - super(SupportedStackResourceProperties, self).__init__(**kwargs) - self.stack_id = stack_id - self.version = version - - -class SupportedStacksCollection(msrest.serialization.Model): - """Object that includes an array of supported stacks resources and a possible link for next set. - - :ivar value: Collection of supported stacks resources. - :vartype value: list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource] - :ivar next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :vartype next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SupportedStackResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - *, - value: Optional[List["SupportedStackResource"]] = None, - next_link: Optional[str] = None, - **kwargs - ): - """ - :keyword value: Collection of supported stacks resources. - :paramtype value: - list[~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource] - :keyword next_link: URL client should use to fetch the next page (per server side paging). - It's null for now, added for future use. - :paramtype next_link: str - """ - super(SupportedStacksCollection, self).__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Possible values include: - "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.LastModifiedByType - :ivar last_modified_at: The timestamp of resource modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "LastModifiedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.appplatform.v2022_05_01_preview.models.LastModifiedByType - :keyword last_modified_at: The timestamp of resource modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super(SystemData, self).__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TCPSocketAction(ProbeAction): - """TCPSocketAction describes an action based on opening a socket. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Required. The type of the action to take to perform the health check.Constant - filled by server. Possible values include: "HTTPGetAction", "TCPSocketAction", "ExecAction". - :vartype type: str or ~azure.mgmt.appplatform.v2022_05_01_preview.models.ProbeActionType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(TCPSocketAction, self).__init__(**kwargs) - self.type = 'TCPSocketAction' # type: str - - -class TemporaryDisk(msrest.serialization.Model): - """Temporary disk payload. - - :ivar size_in_gb: Size of the temporary disk in GB. - :vartype size_in_gb: int - :ivar mount_path: Mount path of the temporary disk. - :vartype mount_path: str - """ - - _validation = { - 'size_in_gb': {'maximum': 5, 'minimum': 0}, - } - - _attribute_map = { - 'size_in_gb': {'key': 'sizeInGB', 'type': 'int'}, - 'mount_path': {'key': 'mountPath', 'type': 'str'}, - } - - def __init__( - self, - *, - size_in_gb: Optional[int] = None, - mount_path: Optional[str] = "/tmp", - **kwargs - ): - """ - :keyword size_in_gb: Size of the temporary disk in GB. - :paramtype size_in_gb: int - :keyword mount_path: Mount path of the temporary disk. - :paramtype mount_path: str - """ - super(TemporaryDisk, self).__init__(**kwargs) - self.size_in_gb = size_in_gb - self.mount_path = mount_path - - -class TestKeys(msrest.serialization.Model): - """Test keys payload. - - :ivar primary_key: Primary key. - :vartype primary_key: str - :ivar secondary_key: Secondary key. - :vartype secondary_key: str - :ivar primary_test_endpoint: Primary test endpoint. - :vartype primary_test_endpoint: str - :ivar secondary_test_endpoint: Secondary test endpoint. - :vartype secondary_test_endpoint: str - :ivar enabled: Indicates whether the test endpoint feature enabled or not. - :vartype enabled: bool - """ - - _attribute_map = { - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'secondary_key': {'key': 'secondaryKey', 'type': 'str'}, - 'primary_test_endpoint': {'key': 'primaryTestEndpoint', 'type': 'str'}, - 'secondary_test_endpoint': {'key': 'secondaryTestEndpoint', 'type': 'str'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - *, - primary_key: Optional[str] = None, - secondary_key: Optional[str] = None, - primary_test_endpoint: Optional[str] = None, - secondary_test_endpoint: Optional[str] = None, - enabled: Optional[bool] = None, - **kwargs - ): - """ - :keyword primary_key: Primary key. - :paramtype primary_key: str - :keyword secondary_key: Secondary key. - :paramtype secondary_key: str - :keyword primary_test_endpoint: Primary test endpoint. - :paramtype primary_test_endpoint: str - :keyword secondary_test_endpoint: Secondary test endpoint. - :paramtype secondary_test_endpoint: str - :keyword enabled: Indicates whether the test endpoint feature enabled or not. - :paramtype enabled: bool - """ - super(TestKeys, self).__init__(**kwargs) - self.primary_key = primary_key - self.secondary_key = secondary_key - self.primary_test_endpoint = primary_test_endpoint - self.secondary_test_endpoint = secondary_test_endpoint - self.enabled = enabled - - -class TriggeredBuildResult(msrest.serialization.Model): - """The build result triggered by a build. - - :ivar id: The unique build id of this build result. - :vartype id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: Optional[str] = None, - **kwargs - ): - """ - :keyword id: The unique build id of this build result. - :paramtype id: str - """ - super(TriggeredBuildResult, self).__init__(**kwargs) - self.id = id - - -class UserAssignedManagedIdentity(msrest.serialization.Model): - """The details of the user-assigned managed identity assigned to an App. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Principal Id of user-assigned managed identity. - :vartype principal_id: str - :ivar client_id: Client Id of user-assigned managed identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - """ - """ - super(UserAssignedManagedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class ValidationMessages(msrest.serialization.Model): - """Validate messages of the configuration service git repositories. - - :ivar name: The name of the configuration service git repository. - :vartype name: str - :ivar messages: Detailed validation messages. - :vartype messages: list[str] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'messages': {'key': 'messages', 'type': '[str]'}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - messages: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword name: The name of the configuration service git repository. - :paramtype name: str - :keyword messages: Detailed validation messages. - :paramtype messages: list[str] - """ - super(ValidationMessages, self).__init__(**kwargs) - self.name = name - self.messages = messages diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.py deleted file mode 100644 index 0da100b4246..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/__init__.py +++ /dev/null @@ -1,57 +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 ._services_operations import ServicesOperations -from ._config_servers_operations import ConfigServersOperations -from ._configuration_services_operations import ConfigurationServicesOperations -from ._service_registries_operations import ServiceRegistriesOperations -from ._build_service_operations import BuildServiceOperations -from ._buildpack_binding_operations import BuildpackBindingOperations -from ._build_service_builder_operations import BuildServiceBuilderOperations -from ._build_service_agent_pool_operations import BuildServiceAgentPoolOperations -from ._monitoring_settings_operations import MonitoringSettingsOperations -from ._apps_operations import AppsOperations -from ._bindings_operations import BindingsOperations -from ._storages_operations import StoragesOperations -from ._certificates_operations import CertificatesOperations -from ._custom_domains_operations import CustomDomainsOperations -from ._deployments_operations import DeploymentsOperations -from ._operations import Operations -from ._runtime_versions_operations import RuntimeVersionsOperations -from ._skus_operations import SkusOperations -from ._gateways_operations import GatewaysOperations -from ._gateway_route_configs_operations import GatewayRouteConfigsOperations -from ._gateway_custom_domains_operations import GatewayCustomDomainsOperations -from ._api_portals_operations import ApiPortalsOperations -from ._api_portal_custom_domains_operations import ApiPortalCustomDomainsOperations - -__all__ = [ - 'ServicesOperations', - 'ConfigServersOperations', - 'ConfigurationServicesOperations', - 'ServiceRegistriesOperations', - 'BuildServiceOperations', - 'BuildpackBindingOperations', - 'BuildServiceBuilderOperations', - 'BuildServiceAgentPoolOperations', - 'MonitoringSettingsOperations', - 'AppsOperations', - 'BindingsOperations', - 'StoragesOperations', - 'CertificatesOperations', - 'CustomDomainsOperations', - 'DeploymentsOperations', - 'Operations', - 'RuntimeVersionsOperations', - 'SkusOperations', - 'GatewaysOperations', - 'GatewayRouteConfigsOperations', - 'GatewayCustomDomainsOperations', - 'ApiPortalsOperations', - 'ApiPortalCustomDomainsOperations', -] diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py deleted file mode 100644 index e422fc49e55..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portal_custom_domains_operations.py +++ /dev/null @@ -1,633 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ApiPortalCustomDomainsOperations(object): - """ApiPortalCustomDomainsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.ApiPortalCustomDomainResource": - """Get the API portal custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiPortalCustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", - **kwargs: Any - ) -> "_models.ApiPortalCustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_custom_domain_resource, 'ApiPortalCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - api_portal_custom_domain_resource: "_models.ApiPortalCustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.ApiPortalCustomDomainResource"]: - """Create or update the API portal custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. - :type domain_name: str - :param api_portal_custom_domain_resource: The API portal custom domain for the create or update - operation. - :type api_portal_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ApiPortalCustomDomainResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_portal_custom_domain_resource=api_portal_custom_domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ApiPortalCustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the API portal custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param domain_name: The name of the API portal custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> Iterable["_models.ApiPortalCustomDomainResourceCollection"]: - """Handle requests to list all API portal custom domains. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalCustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalCustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalCustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py deleted file mode 100644 index 4f4d9e417d1..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_api_portals_operations.py +++ /dev/null @@ -1,719 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - api_portal_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "apiPortalName": _SERIALIZER.url("api_portal_name", api_portal_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class ApiPortalsOperations(object): - """ApiPortalsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> "_models.ApiPortalResource": - """Get the API portal and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ApiPortalResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: "_models.ApiPortalResource", - **kwargs: Any - ) -> "_models.ApiPortalResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(api_portal_resource, 'ApiPortalResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - api_portal_resource: "_models.ApiPortalResource", - **kwargs: Any - ) -> LROPoller["_models.ApiPortalResource"]: - """Create the default API portal or update the existing API portal. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param api_portal_resource: The API portal for the create or update operation. - :type api_portal_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ApiPortalResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_portal_resource=api_portal_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ApiPortalResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the default API portal. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ApiPortalResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApiPortalResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ApiPortalResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApiPortalResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ApiPortalResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals"} # type: ignore - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - api_portal_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the domains are valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param api_portal_name: The name of API portal. - :type api_portal_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_portal_name=api_portal_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apiPortals/{apiPortalName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py deleted file mode 100644 index bb28b7254a9..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_apps_operations.py +++ /dev/null @@ -1,1194 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - sync_status: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if sync_status is not None: - _query_parameters['syncStatus'] = _SERIALIZER.query("sync_status", sync_status, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_set_active_deployments_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class AppsOperations(object): - """AppsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - sync_status: Optional[str] = None, - **kwargs: Any - ) -> "_models.AppResource": - """Get an App and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param sync_status: Indicates whether sync status. Default value is None. - :type sync_status: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AppResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - sync_status=sync_status, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: - """Create a new App or update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the create or update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(app_resource, 'AppResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - app_resource: "_models.AppResource", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: - """Operation to update an exiting App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param app_resource: Parameters for the update operation. - :type app_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - app_resource=app_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.AppResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AppResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AppResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps"} # type: ignore - - @distributed_trace - def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for an App, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/getResourceUploadUrl"} # type: ignore - - - def _set_active_deployments_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> "_models.AppResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(active_deployment_collection, 'ActiveDeploymentCollection') - - request = build_set_active_deployments_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._set_active_deployments_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AppResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AppResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _set_active_deployments_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - - @distributed_trace - def begin_set_active_deployments( - self, - resource_group_name: str, - service_name: str, - app_name: str, - active_deployment_collection: "_models.ActiveDeploymentCollection", - **kwargs: Any - ) -> LROPoller["_models.AppResource"]: - """Set existing Deployment under the app as active. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param active_deployment_collection: A list of Deployment name to be active. - :type active_deployment_collection: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ActiveDeploymentCollection - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either AppResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.AppResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.AppResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._set_active_deployments_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - active_deployment_collection=active_deployment_collection, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('AppResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_set_active_deployments.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/setActiveDeployments"} # type: ignore - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - app_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the resource name is valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py deleted file mode 100644 index cec117d6b31..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_bindings_operations.py +++ /dev/null @@ -1,823 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "bindingName": _SERIALIZER.url("binding_name", binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BindingsOperations(object): - """BindingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> "_models.BindingResource": - """Get a Binding and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: - """Create a new Binding or update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the create or update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> "_models.BindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(binding_resource, 'BindingResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('BindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - binding_name: str, - binding_resource: "_models.BindingResource", - **kwargs: Any - ) -> LROPoller["_models.BindingResource"]: - """Operation to update an exiting Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param binding_name: The name of the Binding resource. - :type binding_name: str - :param binding_resource: Parameters for the update operation. - :type binding_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - binding_name=binding_name, - binding_resource=binding_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings/{bindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.BindingResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BindingResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/bindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py deleted file mode 100644 index b092ac91e9f..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_agent_pool_operations.py +++ /dev/null @@ -1,475 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "agentPoolName": _SERIALIZER.url("agent_pool_name", agent_pool_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class BuildServiceAgentPoolOperations(object): - """BuildServiceAgentPoolOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildServiceAgentPoolResourceCollection"]: - """List build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceAgentPoolResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceAgentPoolResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools"} # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - """Get build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildServiceAgentPoolResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> "_models.BuildServiceAgentPoolResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(agent_pool_resource, 'BuildServiceAgentPoolResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore - - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - agent_pool_name: str, - agent_pool_resource: "_models.BuildServiceAgentPoolResource", - **kwargs: Any - ) -> LROPoller["_models.BuildServiceAgentPoolResource"]: - """Create or update build service agent pool. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param agent_pool_name: The name of the build service agent pool resource. - :type agent_pool_name: str - :param agent_pool_resource: Parameters for the update operation. - :type agent_pool_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuildServiceAgentPoolResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceAgentPoolResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceAgentPoolResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - agent_pool_name=agent_pool_name, - agent_pool_resource=agent_pool_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildServiceAgentPoolResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/agentPools/{agentPoolName}"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py deleted file mode 100644 index a4a7c4b4983..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_builder_operations.py +++ /dev/null @@ -1,631 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BuildServiceBuilderOperations(object): - """BuildServiceBuilderOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> "_models.BuilderResource": - """Get a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuilderResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> "_models.BuilderResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(builder_resource, 'BuilderResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuilderResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - builder_resource: "_models.BuilderResource", - **kwargs: Any - ) -> LROPoller["_models.BuilderResource"]: - """Create or update a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param builder_resource: The target builder for the create or update operation. - :type builder_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuilderResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - builder_resource=builder_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuilderResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a KPack builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuilderResourceCollection"]: - """List KPack builders result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuilderResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuilderResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuilderResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuilderResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py deleted file mode 100644 index 733d0685f2c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_build_service_operations.py +++ /dev/null @@ -1,1506 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_build_services_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_service_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_builds_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_build_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_build_results_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_result_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_build_result_log_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildName": _SERIALIZER.url("build_name", build_name, 'str'), - "buildResultName": _SERIALIZER.url("build_result_name", build_result_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_resource_upload_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_supported_buildpacks_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_supported_buildpack_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "buildpackName": _SERIALIZER.url("buildpack_name", buildpack_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_supported_stacks_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_supported_stack_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "stackName": _SERIALIZER.url("stack_name", stack_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BuildServiceOperations(object): - """BuildServiceOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_build_services( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildServiceCollection"]: - """List build services resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildServiceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildServiceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildServiceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_build_services.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_services_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildServiceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_build_services.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices"} # type: ignore - - @distributed_trace - def get_build_service( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.BuildService": - """Get a build service resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildService, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildService - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildService"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_service_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_build_service.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildService', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_service.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}"} # type: ignore - - - @distributed_trace - def list_builds( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildCollection"]: - """List KPack builds. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildCollection or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_builds.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_builds_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_builds.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds"} # type: ignore - - @distributed_trace - def get_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> "_models.Build": - """Get a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.get_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace - def create_or_update_build( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build: "_models.Build", - **kwargs: Any - ) -> "_models.Build": - """Create or update a KPack build. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build: Parameters for the create or update operation. - :type build: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Build, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.Build - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Build"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(build, 'Build') - - request = build_create_or_update_build_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.create_or_update_build.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Build', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Build', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update_build.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}"} # type: ignore - - - @distributed_trace - def list_build_results( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildResultCollection"]: - """List KPack build results. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildResultCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=self.list_build_results.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_build_results_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildResultCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_build_results.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results"} # type: ignore - - @distributed_trace - def get_build_result( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResult": - """Get a KPack build result. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_result_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}"} # type: ignore - - - @distributed_trace - def get_build_result_log( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - build_name: str, - build_result_name: str, - **kwargs: Any - ) -> "_models.BuildResultLog": - """Get a KPack build result log download URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param build_name: The name of the build resource. - :type build_name: str - :param build_result_name: The name of the build result resource. - :type build_result_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildResultLog, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildResultLog - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildResultLog"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_build_result_log_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - build_name=build_name, - build_result_name=build_result_name, - api_version=api_version, - template_url=self.get_build_result_log.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildResultLog', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_build_result_log.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builds/{buildName}/results/{buildResultName}/getLogFileUrl"} # type: ignore - - - @distributed_trace - def get_resource_upload_url( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.ResourceUploadDefinition": - """Get an resource upload URL for build service, which may be artifacts or source archive. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceUploadDefinition, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceUploadDefinition - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceUploadDefinition"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_resource_upload_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.get_resource_upload_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ResourceUploadDefinition', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_resource_upload_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/getResourceUploadUrl"} # type: ignore - - - @distributed_trace - def list_supported_buildpacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpacksCollection": - """Get all supported buildpacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_supported_buildpacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_buildpacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_buildpacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks"} # type: ignore - - - @distributed_trace - def get_supported_buildpack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - buildpack_name: str, - **kwargs: Any - ) -> "_models.SupportedBuildpackResource": - """Get the supported buildpack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param buildpack_name: The name of the buildpack resource. - :type buildpack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedBuildpackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedBuildpackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedBuildpackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_supported_buildpack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - buildpack_name=buildpack_name, - api_version=api_version, - template_url=self.get_supported_buildpack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedBuildpackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_buildpack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedBuildpacks/{buildpackName}"} # type: ignore - - - @distributed_trace - def list_supported_stacks( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - **kwargs: Any - ) -> "_models.SupportedStacksCollection": - """Get all supported stacks. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStacksCollection, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStacksCollection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStacksCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_supported_stacks_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - api_version=api_version, - template_url=self.list_supported_stacks.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStacksCollection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_supported_stacks.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks"} # type: ignore - - - @distributed_trace - def get_supported_stack( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - stack_name: str, - **kwargs: Any - ) -> "_models.SupportedStackResource": - """Get the supported stack resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param stack_name: The name of the stack resource. - :type stack_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: SupportedStackResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.SupportedStackResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.SupportedStackResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_supported_stack_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - stack_name=stack_name, - api_version=api_version, - template_url=self.get_supported_stack.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('SupportedStackResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_supported_stack.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/supportedStacks/{stackName}"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py deleted file mode 100644 index b9a45d62628..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_buildpack_binding_operations.py +++ /dev/null @@ -1,661 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - "buildpackBindingName": _SERIALIZER.url("buildpack_binding_name", buildpack_binding_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "buildServiceName": _SERIALIZER.url("build_service_name", build_service_name, 'str'), - "builderName": _SERIALIZER.url("builder_name", builder_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class BuildpackBindingOperations(object): - """BuildpackBindingOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - """Get a buildpack binding by name. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: BuildpackBindingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> "_models.BuildpackBindingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(buildpack_binding, 'BuildpackBindingResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - buildpack_binding: "_models.BuildpackBindingResource", - **kwargs: Any - ) -> LROPoller["_models.BuildpackBindingResource"]: - """Create or update a buildpack binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :param buildpack_binding: The target buildpack binding for the create or update operation. - :type buildpack_binding: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either BuildpackBindingResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - buildpack_binding=buildpack_binding, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('BuildpackBindingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - buildpack_binding_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Buildpack Binding. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :param buildpack_binding_name: The name of the Buildpack Binding Name. - :type buildpack_binding_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - buildpack_binding_name=buildpack_binding_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings/{buildpackBindingName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - build_service_name: str, - builder_name: str, - **kwargs: Any - ) -> Iterable["_models.BuildpackBindingResourceCollection"]: - """Handles requests to list all buildpack bindings in a builder. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param build_service_name: The name of the build service resource. - :type build_service_name: str - :param builder_name: The name of the builder resource. - :type builder_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BuildpackBindingResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.BuildpackBindingResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.BuildpackBindingResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - build_service_name=build_service_name, - builder_name=builder_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BuildpackBindingResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/buildServices/{buildServiceName}/builders/{builderName}/buildpackBindings"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py deleted file mode 100644 index 90a20d15344..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_certificates_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class CertificatesOperations(object): - """CertificatesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> "_models.CertificateResource": - """Get the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CertificateResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> "_models.CertificateResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(certificate_resource, 'CertificateResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CertificateResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - certificate_resource: "_models.CertificateResource", - **kwargs: Any - ) -> LROPoller["_models.CertificateResource"]: - """Create or update certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :param certificate_resource: Parameters for the create or update operation. - :type certificate_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CertificateResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - certificate_resource=certificate_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CertificateResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - certificate_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the certificate resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param certificate_name: The name of the certificate resource. - :type certificate_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - certificate_name=certificate_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates/{certificateName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.CertificateResourceCollection"]: - """List all the certificates of one user. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CertificateResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CertificateResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CertificateResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/certificates"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py deleted file mode 100644 index 38b579a33bb..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_config_servers_operations.py +++ /dev/null @@ -1,667 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class ConfigServersOperations(object): - """ConfigServersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ConfigServerResource": - """Get the config server and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigServerResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> "_models.ConfigServerResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_resource, 'ConfigServerResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - config_server_resource: "_models.ConfigServerResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerResource"]: - """Update the config server. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_resource: Parameters for the update operation. - :type config_server_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_resource=config_server_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/default"} # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> "_models.ConfigServerSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(config_server_settings, 'ConfigServerSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore - - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - config_server_settings: "_models.ConfigServerSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigServerSettingsValidateResult"]: - """Check if the config server settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param config_server_settings: Config server settings to be validated. - :type config_server_settings: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigServerSettingsValidateResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigServerSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigServerSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - config_server_settings=config_server_settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigServerSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configServers/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py deleted file mode 100644 index 3658e5a8145..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_configuration_services_operations.py +++ /dev/null @@ -1,785 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "configurationServiceName": _SERIALIZER.url("configuration_service_name", configuration_service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class ConfigurationServicesOperations(object): - """ConfigurationServicesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - """Get the Application Configuration Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ConfigurationServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> "_models.ConfigurationServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(configuration_service_resource, 'ConfigurationServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - configuration_service_resource: "_models.ConfigurationServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ConfigurationServiceResource"]: - """Create the default Application Configuration Service or update the existing Application - Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param configuration_service_resource: Parameters for the update operation. - :type configuration_service_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ConfigurationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - configuration_service_resource=configuration_service_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Application Configuration Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ConfigurationServiceResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfigurationServiceResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConfigurationServiceResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices"} # type: ignore - - def _validate_initial( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> "_models.ConfigurationServiceSettingsValidateResult": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(settings, 'ConfigurationServiceSettings') - - request = build_validate_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._validate_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _validate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore - - - @distributed_trace - def begin_validate( - self, - resource_group_name: str, - service_name: str, - configuration_service_name: str, - settings: "_models.ConfigurationServiceSettings", - **kwargs: Any - ) -> LROPoller["_models.ConfigurationServiceSettingsValidateResult"]: - """Check if the Application Configuration Service settings are valid. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param configuration_service_name: The name of Application Configuration Service. - :type configuration_service_name: str - :param settings: Application Configuration Service settings to be validated. - :type settings: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettings - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either - ConfigurationServiceSettingsValidateResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ConfigurationServiceSettingsValidateResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfigurationServiceSettingsValidateResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._validate_initial( - resource_group_name=resource_group_name, - service_name=service_name, - configuration_service_name=configuration_service_name, - settings=settings, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ConfigurationServiceSettingsValidateResult', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/configurationServices/{configurationServiceName}/validate"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py deleted file mode 100644 index 10105b150f9..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_custom_domains_operations.py +++ /dev/null @@ -1,823 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class CustomDomainsOperations(object): - """CustomDomainsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.CustomDomainResource": - """Get the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: - """Create or update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> "_models.CustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(domain_resource, 'CustomDomainResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - domain_name: str, - domain_resource: "_models.CustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.CustomDomainResource"]: - """Update custom domain of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param domain_name: The name of the custom domain resource. - :type domain_name: str - :param domain_resource: Parameters for the create or update operation. - :type domain_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CustomDomainResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - domain_name=domain_name, - domain_resource=domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('CustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - **kwargs: Any - ) -> Iterable["_models.CustomDomainResourceCollection"]: - """List the custom domains of one lifecycle application. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CustomDomainResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py deleted file mode 100644 index 910bf1d888e..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_deployments_operations.py +++ /dev/null @@ -1,2074 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, List, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_for_cluster_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - version: Optional[List[str]] = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - if version is not None: - _query_parameters['version'] = [_SERIALIZER.query("version", q, 'str') if q is not None else '' for q in version] - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_restart_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_get_log_file_url_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_generate_heap_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_generate_thread_dump_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_start_jfr_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "appName": _SERIALIZER.url("app_name", app_name, 'str'), - "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class DeploymentsOperations(object): # pylint: disable=too-many-public-methods - """DeploymentsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> "_models.DeploymentResource": - """Get a Deployment and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeploymentResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: - """Create a new Deployment or update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the create or update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> "_models.DeploymentResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(deployment_resource, 'DeploymentResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DeploymentResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - deployment_resource: "_models.DeploymentResource", - **kwargs: Any - ) -> LROPoller["_models.DeploymentResource"]: - """Operation to update an exiting Deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param deployment_resource: Parameters for the update operation. - :type deployment_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either DeploymentResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - deployment_resource=deployment_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('DeploymentResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - app_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: - """Handles requests to list all resources in an App. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments"} # type: ignore - - @distributed_trace - def list_for_cluster( - self, - resource_group_name: str, - service_name: str, - version: Optional[List[str]] = None, - **kwargs: Any - ) -> Iterable["_models.DeploymentResourceCollection"]: - """List deployments for a certain service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param version: Version of the deployments to be listed. Default value is None. - :type version: list[str] - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeploymentResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.DeploymentResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeploymentResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=self.list_for_cluster.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_for_cluster_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - version=version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("DeploymentResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_for_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments"} # type: ignore - - def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Start the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start"} # type: ignore - - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Stop the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop"} # type: ignore - - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_restart_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self._restart_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _restart_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - - @distributed_trace - def begin_restart( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Restart the deployment. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._restart_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_restart.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart"} # type: ignore - - @distributed_trace - def get_log_file_url( - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - **kwargs: Any - ) -> Optional["_models.LogFileUrlResponse"]: - """Get deployment log file URL. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: LogFileUrlResponse, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.LogFileUrlResponse or None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogFileUrlResponse"]] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_log_file_url_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - template_url=self.get_log_file_url.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('LogFileUrlResponse', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get_log_file_url.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl"} # type: ignore - - - def _generate_heap_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_heap_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_heap_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_heap_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - - @distributed_trace - def begin_generate_heap_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: - """Generate Heap Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._generate_heap_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_heap_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump"} # type: ignore - - def _generate_thread_dump_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_generate_thread_dump_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._generate_thread_dump_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _generate_thread_dump_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - - @distributed_trace - def begin_generate_thread_dump( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: - """Generate Thread Dump. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._generate_thread_dump_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_generate_thread_dump.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump"} # type: ignore - - def _start_jfr_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(diagnostic_parameters, 'DiagnosticParameters') - - request = build_start_jfr_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._start_jfr_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_jfr_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore - - - @distributed_trace - def begin_start_jfr( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - app_name: str, - deployment_name: str, - diagnostic_parameters: "_models.DiagnosticParameters", - **kwargs: Any - ) -> LROPoller[None]: - """Start JFR. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param app_name: The name of the App resource. - :type app_name: str - :param deployment_name: The name of the Deployment resource. - :type deployment_name: str - :param diagnostic_parameters: Parameters for the diagnostic operation. - :type diagnostic_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.DiagnosticParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_jfr_initial( - resource_group_name=resource_group_name, - service_name=service_name, - app_name=app_name, - deployment_name=deployment_name, - diagnostic_parameters=diagnostic_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start_jfr.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/startJFR"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py deleted file mode 100644 index a0520c689f0..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_custom_domains_operations.py +++ /dev/null @@ -1,633 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "domainName": _SERIALIZER.url("domain_name", domain_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class GatewayCustomDomainsOperations(object): - """GatewayCustomDomainsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> "_models.GatewayCustomDomainResource": - """Get the Spring Cloud Gateway custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GatewayCustomDomainResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", - **kwargs: Any - ) -> "_models.GatewayCustomDomainResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_custom_domain_resource, 'GatewayCustomDomainResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - gateway_custom_domain_resource: "_models.GatewayCustomDomainResource", - **kwargs: Any - ) -> LROPoller["_models.GatewayCustomDomainResource"]: - """Create or update the Spring Cloud Gateway custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. - :type domain_name: str - :param gateway_custom_domain_resource: The gateway custom domain resource for the create or - update operation. - :type gateway_custom_domain_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayCustomDomainResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - gateway_custom_domain_resource=gateway_custom_domain_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GatewayCustomDomainResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - domain_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the Spring Cloud Gateway custom domain. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param domain_name: The name of the Spring Cloud Gateway custom domain. - :type domain_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - domain_name=domain_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains/{domainName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> Iterable["_models.GatewayCustomDomainResourceCollection"]: - """Handle requests to list all Spring Cloud Gateway custom domains. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayCustomDomainResourceCollection or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayCustomDomainResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayCustomDomainResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayCustomDomainResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/domains"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py deleted file mode 100644 index 28ff32b2f6a..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateway_route_configs_operations.py +++ /dev/null @@ -1,634 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - "routeConfigName": _SERIALIZER.url("route_config_name", route_config_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class GatewayRouteConfigsOperations(object): - """GatewayRouteConfigsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> "_models.GatewayRouteConfigResource": - """Get the Spring Cloud Gateway route configs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. - :type route_config_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GatewayRouteConfigResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: "_models.GatewayRouteConfigResource", - **kwargs: Any - ) -> "_models.GatewayRouteConfigResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_route_config_resource, 'GatewayRouteConfigResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - gateway_route_config_resource: "_models.GatewayRouteConfigResource", - **kwargs: Any - ) -> LROPoller["_models.GatewayRouteConfigResource"]: - """Create the default Spring Cloud Gateway route configs or update the existing Spring Cloud - Gateway route configs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. - :type route_config_name: str - :param gateway_route_config_resource: The Spring Cloud Gateway route config for the create or - update operation. - :type gateway_route_config_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayRouteConfigResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - gateway_route_config_resource=gateway_route_config_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GatewayRouteConfigResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - route_config_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the Spring Cloud Gateway route config. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param route_config_name: The name of the Spring Cloud Gateway route config. - :type route_config_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - route_config_name=route_config_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs/{routeConfigName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> Iterable["_models.GatewayRouteConfigResourceCollection"]: - """Handle requests to list all Spring Cloud Gateway route configs. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayRouteConfigResourceCollection or the result - of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayRouteConfigResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayRouteConfigResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayRouteConfigResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/routeConfigs"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py deleted file mode 100644 index e609f373487..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_gateways_operations.py +++ /dev/null @@ -1,719 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_validate_domain_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - gateway_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class GatewaysOperations(object): - """GatewaysOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> "_models.GatewayResource": - """Get the Spring Cloud Gateway and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: GatewayResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('GatewayResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: "_models.GatewayResource", - **kwargs: Any - ) -> "_models.GatewayResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(gateway_resource, 'GatewayResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('GatewayResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('GatewayResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - gateway_resource: "_models.GatewayResource", - **kwargs: Any - ) -> LROPoller["_models.GatewayResource"]: - """Create the default Spring Cloud Gateway or update the existing Spring Cloud Gateway. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param gateway_resource: The gateway for the create or update operation. - :type gateway_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either GatewayResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - gateway_resource=gateway_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('GatewayResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Spring Cloud Gateway. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.GatewayResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GatewayResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.GatewayResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewayResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GatewayResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways"} # type: ignore - - @distributed_trace - def validate_domain( - self, - resource_group_name: str, - service_name: str, - gateway_name: str, - validate_payload: "_models.CustomDomainValidatePayload", - **kwargs: Any - ) -> "_models.CustomDomainValidateResult": - """Check the domains are valid as well as not in use. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param gateway_name: The name of Spring Cloud Gateway. - :type gateway_name: str - :param validate_payload: Custom domain payload to be validated. - :type validate_payload: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidatePayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: CustomDomainValidateResult, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.CustomDomainValidateResult - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomDomainValidateResult"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(validate_payload, 'CustomDomainValidatePayload') - - request = build_validate_domain_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - gateway_name=gateway_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.validate_domain.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CustomDomainValidateResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - validate_domain.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/gateways/{gatewayName}/validateDomain"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py deleted file mode 100644 index 568d1ddf555..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_monitoring_settings_operations.py +++ /dev/null @@ -1,493 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_put_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_update_patch_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - -class MonitoringSettingsOperations(object): - """MonitoringSettingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - """Get the Monitoring Setting and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MonitoringSettingResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - def _update_put_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_put_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_put_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace - def begin_update_put( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_put_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - def _update_patch_initial( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> "_models.MonitoringSettingResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(monitoring_setting_resource, 'MonitoringSettingResource') - - request = build_update_patch_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_patch_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_patch_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore - - - @distributed_trace - def begin_update_patch( - self, - resource_group_name: str, - service_name: str, - monitoring_setting_resource: "_models.MonitoringSettingResource", - **kwargs: Any - ) -> LROPoller["_models.MonitoringSettingResource"]: - """Update the Monitoring Setting. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param monitoring_setting_resource: Parameters for the update operation. - :type monitoring_setting_resource: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MonitoringSettingResource or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.MonitoringSettingResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MonitoringSettingResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_patch_initial( - resource_group_name=resource_group_name, - service_name=service_name, - monitoring_setting_resource=monitoring_setting_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('MonitoringSettingResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update_patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/monitoringSettings/default"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py deleted file mode 100644 index c4057762256..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_operations.py +++ /dev/null @@ -1,144 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/operations") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.AvailableOperations"]: - """Lists all of the available REST API operations of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AvailableOperations or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableOperations] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AvailableOperations", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/providers/Microsoft.AppPlatform/operations"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py deleted file mode 100644 index b099daba723..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_runtime_versions_operations.py +++ /dev/null @@ -1,122 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_runtime_versions_request( - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.AppPlatform/runtimeVersions") - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class RuntimeVersionsOperations(object): - """RuntimeVersionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list_runtime_versions( - self, - **kwargs: Any - ) -> "_models.AvailableRuntimeVersions": - """Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AvailableRuntimeVersions, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.AvailableRuntimeVersions - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableRuntimeVersions"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_runtime_versions_request( - api_version=api_version, - template_url=self.list_runtime_versions.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AvailableRuntimeVersions', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_runtime_versions.metadata = {'url': "/providers/Microsoft.AppPlatform/runtimeVersions"} # type: ignore - diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py deleted file mode 100644 index d3a04dd5738..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_service_registries_operations.py +++ /dev/null @@ -1,582 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "serviceRegistryName": _SERIALIZER.url("service_registry_name", service_registry_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ServiceRegistriesOperations(object): - """ServiceRegistriesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - """Get the Service Registry and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceRegistryResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> "_models.ServiceRegistryResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> LROPoller["_models.ServiceRegistryResource"]: - """Create the default Service Registry or update the existing Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceRegistryResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceRegistryResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - service_registry_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Disable the default Service Registry. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param service_registry_name: The name of Service Registry. - :type service_registry_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - service_registry_name=service_registry_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries/{serviceRegistryName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceRegistryResourceCollection"]: - """Handles requests to list all resources in a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceRegistryResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceRegistryResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceRegistryResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceRegistryResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/serviceRegistries"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py deleted file mode 100644 index 7bd2702945c..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_services_operations.py +++ /dev/null @@ -1,1630 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PATCH", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_test_keys_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_regenerate_test_key_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_disable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_enable_test_endpoint_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_stop_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_start_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_check_name_availability_request( - subscription_id: str, - location: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - "location": _SERIALIZER.url("location", location, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="POST", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_list_by_subscription_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring") # 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'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class ServicesOperations(object): - """ServicesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.ServiceResource": - """Get a Service and its properties. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ServiceResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: - """Create a new Service or update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the create or update operation. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Operation to delete a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - def _update_initial( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(resource, 'ServiceResource') - - request = build_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('ServiceResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - service_name: str, - resource: "_models.ServiceResource", - **kwargs: Any - ) -> LROPoller["_models.ServiceResource"]: - """Operation to update an exiting Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param resource: Parameters for the update operation. - :type resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - resource=resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}"} # type: ignore - - @distributed_trace - def list_test_keys( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """List test keys for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_list_test_keys_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list_test_keys.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_test_keys.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/listTestKeys"} # type: ignore - - - @distributed_trace - def regenerate_test_key( - self, - resource_group_name: str, - service_name: str, - regenerate_test_key_request: "_models.RegenerateTestKeyRequestPayload", - **kwargs: Any - ) -> "_models.TestKeys": - """Regenerate a test key for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param regenerate_test_key_request: Parameters for the operation. - :type regenerate_test_key_request: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.RegenerateTestKeyRequestPayload - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(regenerate_test_key_request, 'RegenerateTestKeyRequestPayload') - - request = build_regenerate_test_key_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.regenerate_test_key.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - regenerate_test_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/regenerateTestKey"} # type: ignore - - - @distributed_trace - def disable_test_endpoint( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - """Disable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_disable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.disable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - disable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/disableTestEndpoint"} # type: ignore - - - @distributed_trace - def enable_test_endpoint( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> "_models.TestKeys": - """Enable test endpoint functionality for a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: TestKeys, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.TestKeys - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.TestKeys"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_enable_test_endpoint_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.enable_test_endpoint.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('TestKeys', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - enable_test_endpoint.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/enableTestEndpoint"} # type: ignore - - - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_stop_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._stop_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - - - @distributed_trace - def begin_stop( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Stop a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop"} # type: ignore - - def _start_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_start_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self._start_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - - - @distributed_trace - def begin_start( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Start a Service. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start"} # type: ignore - - @distributed_trace - def check_name_availability( - self, - location: str, - availability_parameters: "_models.NameAvailabilityParameters", - **kwargs: Any - ) -> "_models.NameAvailability": - """Checks that the resource name is valid and is not already in use. - - :param location: the region. - :type location: str - :param availability_parameters: Parameters supplied to the operation. - :type availability_parameters: - ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailabilityParameters - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NameAvailability, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.NameAvailability - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailability"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(availability_parameters, 'NameAvailabilityParameters') - - request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - location=location, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self.check_name_availability.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('NameAvailability', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/locations/{location}/checkNameAvailability"} # type: ignore - - - @distributed_trace - def list_by_subscription( - self, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_by_subscription.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/Spring"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - **kwargs: Any - ) -> Iterable["_models.ServiceResourceList"]: - """Handles requests to list all resources in a resource group. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ServiceResourceList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ServiceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py deleted file mode 100644 index a49de3f263f..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_skus_operations.py +++ /dev/null @@ -1,153 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_list_request( - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class SkusOperations(object): - """SkusOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def list( - self, - **kwargs: Any - ) -> Iterable["_models.ResourceSkuCollection"]: - """Lists all of the available skus of the Microsoft.AppPlatform provider. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceSkuCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.ResourceSkuCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceSkuCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ResourceSkuCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AppPlatform/skus"} # type: ignore diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py deleted file mode 100644 index ec3d2a79801..00000000000 --- a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_05_01_preview/operations/_storages_operations.py +++ /dev/null @@ -1,605 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union - -from msrest import Serializer - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._vendor import _convert_request, _format_url_section -T = TypeVar('T') -JSONType = Any -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - -def build_get_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_create_or_update_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - *, - json: JSONType = None, - content: Any = None, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="PUT", - url=_url, - params=_query_parameters, - headers=_header_parameters, - json=json, - content=content, - **kwargs - ) - - -def build_delete_request_initial( - subscription_id: str, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - "storageName": _SERIALIZER.url("storage_name", storage_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="DELETE", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - - -def build_list_request( - subscription_id: str, - resource_group_name: str, - service_name: str, - **kwargs: Any -) -> HttpRequest: - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - accept = "application/json" - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages") # 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'), - "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - - # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') - - return HttpRequest( - method="GET", - url=_url, - params=_query_parameters, - headers=_header_parameters, - **kwargs - ) - -class StoragesOperations(object): - """StoragesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.appplatform.v2022_05_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - @distributed_trace - def get( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> "_models.StorageResource": - """Get the storage resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param storage_name: The name of the storage resource. - :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: StorageResource, or the result of cls(response) - :rtype: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_get_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self.get.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('StorageResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - def _create_or_update_initial( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> "_models.StorageResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - - _json = self._serialize.body(storage_resource, 'StorageResource') - - request = build_create_or_update_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - content_type=content_type, - json=_json, - template_url=self._create_or_update_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('StorageResource', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('StorageResource', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('StorageResource', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - service_name: str, - storage_name: str, - storage_resource: "_models.StorageResource", - **kwargs: Any - ) -> LROPoller["_models.StorageResource"]: - """Create or update storage resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param storage_name: The name of the storage resource. - :type storage_name: str - :param storage_resource: Parameters for the create or update operation. - :type storage_resource: ~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either StorageResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResource] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResource"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - storage_resource=storage_resource, - api_version=api_version, - content_type=content_type, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - response = pipeline_response.http_response - deserialized = self._deserialize('StorageResource', pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - - request = build_delete_request_initial( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - template_url=self._delete_initial.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - - @distributed_trace - def begin_delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - service_name: str, - storage_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Delete the storage resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :param storage_name: The name of the storage resource. - :type storage_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - service_name=service_name, - storage_name=storage_name, - api_version=api_version, - cls=lambda x,y,z: x, - **kwargs - ) - kwargs.pop('error_map', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - - begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}"} # type: ignore - - @distributed_trace - def list( - self, - resource_group_name: str, - service_name: str, - **kwargs: Any - ) -> Iterable["_models.StorageResourceCollection"]: - """List all the storages of one Azure Spring Apps resource. - - :param resource_group_name: The name of the resource group that contains the resource. You can - obtain this value from the Azure Resource Manager API or the portal. - :type resource_group_name: str - :param service_name: The name of the Service resource. - :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either StorageResourceCollection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.appplatform.v2022_05_01_preview.models.StorageResourceCollection] - :raises: ~azure.core.exceptions.HttpResponseError - """ - api_version = kwargs.pop('api_version', "2022-05-01-preview") # type: str - - cls = kwargs.pop('cls', None) # type: ClsType["_models.StorageResourceCollection"] - error_map = { - 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError - } - error_map.update(kwargs.pop('error_map', {})) - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=self.list.metadata['url'], - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - - request = build_list_request( - subscription_id=self._config.subscription_id, - resource_group_name=resource_group_name, - service_name=service_name, - api_version=api_version, - template_url=next_link, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("StorageResourceCollection", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access - request, - stream=False, - **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages"} # type: ignore From 549e30f01f6764ea9dc1fb89bf469d862e4ceac7 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Thu, 19 May 2022 10:28:06 +0800 Subject: [PATCH 06/21] update sdk --- .../appplatform/v2022_03_01_preview/_patch.py | 31 +++++++++++++++++++ .../v2022_03_01_preview/_vendor.py | 27 ++++++++++++++++ .../v2022_03_01_preview/aio/_patch.py | 31 +++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py create mode 100644 src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py new file mode 100644 index 00000000000..138f663c53a --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py new file mode 100644 index 00000000000..74e48ecd07c --- /dev/null +++ b/src/spring/azext_spring/vendored_sdks/appplatform/v2022_03_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file From 76cd78afebd1b48411b0cd4b61d60a5a86727cd1 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Thu, 19 May 2022 16:50:20 +0800 Subject: [PATCH 07/21] update api version --- src/spring/azext_spring/commands.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/spring/azext_spring/commands.py b/src/spring/azext_spring/commands.py index 18473c06f6e..6c3cbc70b12 100644 --- a/src/spring/azext_spring/commands.py +++ b/src/spring/azext_spring/commands.py @@ -35,7 +35,7 @@ def load_command_table(self, _): app_command = CliCommandType( operations_tmpl='azext_spring.app#{}', - client_factory=cf_spring_20220501preview + client_factory=cf_spring_20220301preview ) app_managed_identity_command = CliCommandType( @@ -126,7 +126,6 @@ def load_command_table(self, _): exception_handler=handle_asc_exception) as g: g.custom_command('create', 'app_create') g.custom_command('update', 'app_update', supports_no_wait=True) - g.custom_command('deploy', 'app_deploy', supports_no_wait=True) with self.command_group('spring app', client_factory=cf_spring_20220101preview, exception_handler=handle_asc_exception) as g: @@ -160,12 +159,16 @@ def load_command_table(self, _): deprecate_info=g.deprecate(redirect='az spring app logs', hide=True), exception_handler=handle_asc_exception) as g: g.custom_command('tail', 'app_tail_log') + + with self.command_group('spring app', custom_command_type=app_command, client_factory=cf_spring_20220501preview, + exception_handler=handle_asc_exception) as g: + g.custom_command('deploy', 'app_deploy', supports_no_wait=True) - with self.command_group('spring app deployment', custom_command_type=app_command, + with self.command_group('spring app deployment', custom_command_type=app_command, client_factory=cf_spring_20220501preview, exception_handler=handle_asc_exception) as g: g.custom_command('create', 'deployment_create', supports_no_wait=True) - with self.command_group('spring app deployment', client_factory=cf_spring_20220501preview, + with self.command_group('spring app deployment', client_factory=cf_spring_20220101preview, exception_handler=handle_asc_exception) as g: g.custom_command('list', 'deployment_list', table_transformer=transform_spring_deployment_output) From 8717868573864edb986c6ce621ccc2be6a6d0677 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 09:35:13 +0800 Subject: [PATCH 08/21] fix test --- .../latest/recordings/test_app_deploy_container.yaml | 8 ++++---- .../latest/recordings/test_app_deploy_container.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml index 18127e48f0f..bf1bf2be08b 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml @@ -331,7 +331,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}' @@ -1165,7 +1165,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}}' @@ -1586,7 +1586,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:12:58.9051731Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:58.9051731Z"}}' @@ -2113,7 +2113,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:13:49.2620106Z"}}' diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml index 21ca6ca6a81..0b07d114ae8 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml @@ -331,7 +331,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}' @@ -1165,7 +1165,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}}' @@ -1586,7 +1586,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:12:58.9051731Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:58.9051731Z"}}' @@ -2113,7 +2113,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:13:49.2620106Z"}}' From c356308117871318ae94d0edcbd68d945ef81d62 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 09:54:44 +0800 Subject: [PATCH 09/21] fix test --- src/spring/azext_spring/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spring/azext_spring/commands.py b/src/spring/azext_spring/commands.py index 6c3cbc70b12..2fc99a7f39e 100644 --- a/src/spring/azext_spring/commands.py +++ b/src/spring/azext_spring/commands.py @@ -159,7 +159,7 @@ def load_command_table(self, _): deprecate_info=g.deprecate(redirect='az spring app logs', hide=True), exception_handler=handle_asc_exception) as g: g.custom_command('tail', 'app_tail_log') - + with self.command_group('spring app', custom_command_type=app_command, client_factory=cf_spring_20220501preview, exception_handler=handle_asc_exception) as g: g.custom_command('deploy', 'app_deploy', supports_no_wait=True) From bb9d3725c4353c919de33e7e2485314142aa78d1 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 10:08:29 +0800 Subject: [PATCH 10/21] fix test --- .../latest/recordings/test_app_deploy_container.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml index bf1bf2be08b..18127e48f0f 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/recordings/test_app_deploy_container.yaml @@ -331,7 +331,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}' @@ -1165,7 +1165,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview response: body: string: '{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}}' @@ -1586,7 +1586,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview response: body: string: '{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:12:58.9051731Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:58.9051731Z"}}' @@ -2113,7 +2113,7 @@ interactions: User-Agent: - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:13:49.2620106Z"}}' From 9b8fe7165807ac5f5221ef082385175a590b2d3a Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 11:02:28 +0800 Subject: [PATCH 11/21] fix test --- .../azext_spring/tests/latest/recordings/test_app_crud.yaml | 6 +++--- .../tests/latest/recordings/test_app_crud_1.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml index f7e933c578d..b32bdc81daf 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml @@ -647,7 +647,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-05-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}]}' @@ -699,7 +699,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-05-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}]}' @@ -1437,7 +1437,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-05-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-b5cc4b89c-dx8nq","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:40:48Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:30.6458502Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-5c966c975-gsnhd","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"},{"name":"test-crud-app-green-13-5c966c975-x2dvs","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:52.2185677Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:52.2185677Z"}}]}' diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml index 1eb014c4e01..c8daeba3535 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml @@ -65,7 +65,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-05-01-preview response: body: string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 @@ -701,7 +701,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-05-01-preview response: body: string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 From 6147b8bfd57012f2253596b9e1376935522273e6 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 11:04:59 +0800 Subject: [PATCH 12/21] fix test --- .../tests/latest/recordings/test_blue_green_deployment.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml b/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml index 1546ead6be1..af7833b7fb9 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml @@ -696,7 +696,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-05-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}]}' @@ -748,7 +748,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-05-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}]}' @@ -1377,7 +1377,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-05-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}]}' From 45c103dc14c40818e464f2fd9442c968ee790c3d Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 11:30:15 +0800 Subject: [PATCH 13/21] fix test --- .../tests/latest/recordings/test_deploy_app.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml b/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml index d315590e529..8cc215afceb 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml @@ -806,7 +806,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-05-01-preview response: body: string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","uploadUrl":"https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802?sv=2018-03-28&sr=f&sig=De1%2BDkJxr1oOMnvoX3Vr80YdKnkCRM76XtoLpjnN4iE%3D&se=2022-03-20T08%3A27%3A39Z&sp=w"}' @@ -1867,7 +1867,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-05-01-preview response: body: string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","uploadUrl":"https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826?sv=2018-03-28&sr=f&sig=ZshAYB8PCczY6GxQFF%2FGfoER2cAqMpo2ice2ka4k14Q%3D&se=2022-03-20T08%3A29%3A24Z&sp=w"}' @@ -3022,7 +3022,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-05-01-preview response: body: string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773","uploadUrl":"https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773?sv=2018-03-28&sr=f&sig=9Z2Fz59gmKPgpfrxwbE3y9b5MvSQh4VbJWTZD6uMPy0%3D&se=2022-03-20T08%3A31%3A56Z&sp=w"}' From 893c76338bdd5f859a38bbeda78459bc7acaa45a Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 12:05:21 +0800 Subject: [PATCH 14/21] fix test --- .../tests/latest/recordings/test_app_crud_1.yaml | 4 ++-- .../tests/latest/recordings/test_blue_green_deployment.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml index c8daeba3535..1eb014c4e01 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml @@ -65,7 +65,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview response: body: string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 @@ -701,7 +701,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview response: body: string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 diff --git a/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml b/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml index af7833b7fb9..1546ead6be1 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml @@ -696,7 +696,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}]}' @@ -748,7 +748,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}]}' @@ -1377,7 +1377,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}]}' From 3d3da92d85fc25bf6d738351247fd241ae2970a2 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 12:16:55 +0800 Subject: [PATCH 15/21] fix test --- .../azext_spring/tests/latest/recordings/test_app_crud.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml index b32bdc81daf..f7e933c578d 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml @@ -647,7 +647,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}]}' @@ -699,7 +699,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}]}' @@ -1437,7 +1437,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview response: body: string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-b5cc4b89c-dx8nq","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:40:48Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:30.6458502Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-5c966c975-gsnhd","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"},{"name":"test-crud-app-green-13-5c966c975-x2dvs","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:52.2185677Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:52.2185677Z"}}]}' From 2d409cfa880706cd2afb4178fd2d58040bb642a4 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 14:46:48 +0800 Subject: [PATCH 16/21] fix test --- src/spring/azext_spring/_params.py | 4 +- .../latest/recordings/test_app_crud.yaml | 544 ++++--- .../test_blue_green_deployment.yaml | 456 +++--- .../latest/recordings/test_deploy_app.yaml | 1318 +++++++++++------ 4 files changed, 1459 insertions(+), 863 deletions(-) diff --git a/src/spring/azext_spring/_params.py b/src/spring/azext_spring/_params.py index 4ba49d60fce..fa219cef2bb 100644 --- a/src/spring/azext_spring/_params.py +++ b/src/spring/azext_spring/_params.py @@ -373,9 +373,9 @@ def prepare_logs_argument(c): c.argument( 'build_env', build_env_type) c.argument( - 'build_cpu', arg_type=build_cpu_type) + 'build_cpu', arg_type=build_cpu_type, default="1") c.argument( - 'build_memory', arg_type=build_memory_type) + 'build_memory', arg_type=build_memory_type, default="2Gi") with self.argument_context('spring app deploy') as c: c.argument('source_path', arg_type=source_path_type, validator=validate_deloy_path) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml index f7e933c578d..cf5ddec9350 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_crud.yaml @@ -13,7 +13,7 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: @@ -23,11 +23,11 @@ interactions: cache-control: - no-cache content-length: - - '253' + - '227' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:38:24 GMT + - Fri, 20 May 2022 06:34:19 GMT expires: - '-1' pragma: @@ -41,9 +41,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11996' + - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 404 message: Not Found @@ -61,22 +61,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 - 02:02:01 +0800","service-expire-time":"2022-03-20 13:02:01 +0800"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","createdByType":"Application","createdAt":"2022-03-19T18:02:10.1198327Z","lastModifiedBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","lastModifiedByType":"Application","lastModifiedAt":"2022-03-19T19:56:42.9425082Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '1011' + - '770' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:38:24 GMT + - Fri, 20 May 2022 06:34:20 GMT expires: - '-1' pragma: @@ -96,7 +95,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -119,27 +118,27 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:38:25.7053649Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:21.5006354Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/44bff47f-8195-4ec3-aec1-aba72eb0883d?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/ee508ab5-c74d-4622-8e20-3fec1ee93fd1?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '743' + - '718' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:38:33 GMT + - Fri, 20 May 2022 06:34:21 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/44bff47f-8195-4ec3-aec1-aba72eb0883d/Spring/test-crud-app?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/ee508ab5-c74d-4622-8e20-3fec1ee93fd1/Spring/test-crud-app?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -151,9 +150,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1198' + - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -171,21 +170,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/44bff47f-8195-4ec3-aec1-aba72eb0883d?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/ee508ab5-c74d-4622-8e20-3fec1ee93fd1?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/44bff47f-8195-4ec3-aec1-aba72eb0883d","name":"44bff47f-8195-4ec3-aec1-aba72eb0883d","status":"Succeeded","startTime":"2022-03-20T06:38:34.7837881Z","endTime":"2022-03-20T06:38:41.1028471Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/ee508ab5-c74d-4622-8e20-3fec1ee93fd1","name":"ee508ab5-c74d-4622-8e20-3fec1ee93fd1","status":"Succeeded","startTime":"2022-05-20T06:34:22.2200952Z","endTime":"2022-05-20T06:34:28.649359Z"}' headers: cache-control: - no-cache content-length: - - '375' + - '356' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:04 GMT + - Fri, 20 May 2022 06:34:52 GMT expires: - '-1' pragma: @@ -203,7 +202,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -221,21 +220,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:38:25.7053649Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:21.5006354Z"}}' headers: cache-control: - no-cache content-length: - - '861' + - '821' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:05 GMT + - Fri, 20 May 2022 06:34:53 GMT expires: - '-1' pragma: @@ -253,9 +252,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11995' + - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -280,27 +279,27 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:57.5631735Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/737d261e-545c-400e-b7ff-26fd76a556ab?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/af46322c-7a8a-4f5f-b792-9dbd86f7cf0a?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '826' + - '808' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:11 GMT + - Fri, 20 May 2022 06:34:58 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/737d261e-545c-400e-b7ff-26fd76a556ab/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/af46322c-7a8a-4f5f-b792-9dbd86f7cf0a/Spring/default?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -314,7 +313,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1198' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -337,27 +336,27 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:11.7993116Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:59.0163002Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/9d90db75-96c3-49cd-b3c2-f6dd981e0270?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/1bcf4d63-059b-4e33-bfa8-617e38dae2ec?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '860' + - '820' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:11 GMT + - Fri, 20 May 2022 06:34:59 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/9d90db75-96c3-49cd-b3c2-f6dd981e0270/Spring/test-crud-app?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/1bcf4d63-059b-4e33-bfa8-617e38dae2ec/Spring/test-crud-app?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -369,9 +368,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1197' + - '1198' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -389,21 +388,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/737d261e-545c-400e-b7ff-26fd76a556ab?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/af46322c-7a8a-4f5f-b792-9dbd86f7cf0a?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/737d261e-545c-400e-b7ff-26fd76a556ab","name":"737d261e-545c-400e-b7ff-26fd76a556ab","status":"Succeeded","startTime":"2022-03-20T06:39:11.499709Z","endTime":"2022-03-20T06:39:25.546966Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/af46322c-7a8a-4f5f-b792-9dbd86f7cf0a","name":"af46322c-7a8a-4f5f-b792-9dbd86f7cf0a","status":"Running","startTime":"2022-05-20T06:34:58.7121533Z"}' headers: cache-control: - no-cache content-length: - - '367' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:41 GMT + - Fri, 20 May 2022 06:35:29 GMT expires: - '-1' pragma: @@ -421,7 +420,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -439,21 +438,71 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/1bcf4d63-059b-4e33-bfa8-617e38dae2ec?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/1bcf4d63-059b-4e33-bfa8-617e38dae2ec","name":"1bcf4d63-059b-4e33-bfa8-617e38dae2ec","status":"Succeeded","startTime":"2022-05-20T06:34:59.7593414Z","endTime":"2022-05-20T06:35:06.1245878Z"}' + headers: + cache-control: + - no-cache + content-length: + - '357' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:35:30 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app create + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --cpu --env + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:59.0163002Z"}}' headers: cache-control: - no-cache content-length: - - '954' + - '821' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:41 GMT + - Fri, 20 May 2022 06:35:31 GMT expires: - '-1' pragma: @@ -473,7 +522,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11997' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -491,21 +540,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/9d90db75-96c3-49cd-b3c2-f6dd981e0270?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/af46322c-7a8a-4f5f-b792-9dbd86f7cf0a?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/9d90db75-96c3-49cd-b3c2-f6dd981e0270","name":"9d90db75-96c3-49cd-b3c2-f6dd981e0270","status":"Succeeded","startTime":"2022-03-20T06:39:12.1266234Z","endTime":"2022-03-20T06:39:19.5227321Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/af46322c-7a8a-4f5f-b792-9dbd86f7cf0a","name":"af46322c-7a8a-4f5f-b792-9dbd86f7cf0a","status":"Succeeded","startTime":"2022-05-20T06:34:58.7121533Z","endTime":"2022-05-20T06:35:39.044382Z"}' headers: cache-control: - no-cache content-length: - - '375' + - '350' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:43 GMT + - Fri, 20 May 2022 06:35:39 GMT expires: - '-1' pragma: @@ -523,7 +572,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -541,21 +590,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:11.7993116Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-cc58b7c95-spl4t","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:35:02Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:57.5631735Z"}}' headers: cache-control: - no-cache content-length: - - '861' + - '945' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:43 GMT + - Fri, 20 May 2022 06:35:42 GMT expires: - '-1' pragma: @@ -573,9 +622,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -593,21 +642,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:11.7993116Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:59.0163002Z"}}' headers: cache-control: - no-cache content-length: - - '861' + - '821' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:48 GMT + - Fri, 20 May 2022 06:35:45 GMT expires: - '-1' pragma: @@ -625,9 +674,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' + - '11996' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -645,21 +694,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-cc58b7c95-spl4t","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:35:02Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:57.5631735Z"}}]}' headers: cache-control: - no-cache content-length: - - '966' + - '957' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:49 GMT + - Fri, 20 May 2022 06:35:48 GMT expires: - '-1' pragma: @@ -677,9 +726,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11997' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -697,21 +746,21 @@ interactions: ParameterSetName: - -n --app -g -s --instance-count User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-05-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"},"terminationGracePeriodSeconds":0,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-cc58b7c95-spl4t","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:35:02Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:57.5631735Z"}}]}' headers: cache-control: - no-cache content-length: - - '966' + - '1362' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:50 GMT + - Fri, 20 May 2022 06:35:52 GMT expires: - '-1' pragma: @@ -729,9 +778,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11996' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -756,27 +805,27 @@ interactions: ParameterSetName: - -n --app -g -s --instance-count User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:52.2185677Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:52.2185677Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"},"terminationGracePeriodSeconds":0},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:35:52.6257449Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:35:52.6257449Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/5e73e921-f0de-41e8-bcff-fcd312ac5c40?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6?api-version=2022-05-01-preview cache-control: - no-cache content-length: - - '823' + - '839' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:39:54 GMT + - Fri, 20 May 2022 06:35:56 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/5e73e921-f0de-41e8-bcff-fcd312ac5c40/Spring/green?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6/Spring/green?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -788,9 +837,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1199' + - '1197' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -808,21 +857,21 @@ interactions: ParameterSetName: - -n --app -g -s --instance-count User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/5e73e921-f0de-41e8-bcff-fcd312ac5c40?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/5e73e921-f0de-41e8-bcff-fcd312ac5c40","name":"5e73e921-f0de-41e8-bcff-fcd312ac5c40","status":"Succeeded","startTime":"2022-03-20T06:39:54.5899151Z","endTime":"2022-03-20T06:40:07.5842391Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6","name":"e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6","status":"Running","startTime":"2022-05-20T06:35:56.7616218Z"}' headers: cache-control: - no-cache content-length: - - '367' + - '306' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:40:24 GMT + - Fri, 20 May 2022 06:36:26 GMT expires: - '-1' pragma: @@ -840,7 +889,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -858,21 +907,121 @@ interactions: ParameterSetName: - -n --app -g -s --instance-count User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6?api-version=2022-05-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6","name":"e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6","status":"Running","startTime":"2022-05-20T06:35:56.7616218Z"}' + headers: + cache-control: + - no-cache + content-length: + - '306' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:36:37 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app deployment create + Connection: + - keep-alive + ParameterSetName: + - -n --app -g -s --instance-count + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6?api-version=2022-05-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6","name":"e3e6b4a9-f105-4fe3-8c5a-4f722f0147f6","status":"Succeeded","startTime":"2022-05-20T06:35:56.7616218Z","endTime":"2022-05-20T06:36:43.4102318Z"}' + headers: + cache-control: + - no-cache + content-length: + - '349' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:36:47 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app deployment create + Connection: + - keep-alive + ParameterSetName: + - -n --app -g -s --instance-count + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-5c966c975-gsnhd","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"},{"name":"test-crud-app-green-13-5c966c975-x2dvs","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:52.2185677Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:52.2185677Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"},"terminationGracePeriodSeconds":0,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-69c4dc74d8-5km5x","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:35:57Z"},{"name":"test-crud-app-green-13-69c4dc74d8-zl45r","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:36:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:35:52.6257449Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:35:52.6257449Z"}}' headers: cache-control: - no-cache content-length: - - '1099' + - '1484' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:40:24 GMT + - Fri, 20 May 2022 06:36:50 GMT expires: - '-1' pragma: @@ -890,9 +1039,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' + - '11995' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -910,21 +1059,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-66996dd58f-2ppwh","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:39:14Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:10.0805587Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-5c966c975-gsnhd","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"},{"name":"test-crud-app-green-13-5c966c975-x2dvs","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:52.2185677Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:52.2185677Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-cc58b7c95-spl4t","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:35:02Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:34:57.5631735Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-69c4dc74d8-5km5x","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:35:57Z"},{"name":"test-crud-app-green-13-69c4dc74d8-zl45r","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:36:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:35:52.6257449Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:35:52.6257449Z"}}]}' headers: cache-control: - no-cache content-length: - - '2066' + - '2037' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:40:27 GMT + - Fri, 20 May 2022 06:36:55 GMT expires: - '-1' pragma: @@ -942,9 +1091,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11997' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -962,22 +1111,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-01-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 - 02:02:01 +0800","service-expire-time":"2022-03-20 13:02:01 +0800"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","createdByType":"Application","createdAt":"2022-03-19T18:02:10.1198327Z","lastModifiedBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","lastModifiedByType":"Application","lastModifiedAt":"2022-03-19T19:56:42.9425082Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '1011' + - '770' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:40:28 GMT + - Fri, 20 May 2022 06:36:57 GMT expires: - '-1' pragma: @@ -995,9 +1143,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1019,27 +1167,27 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:29.677089Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:36:58.8132691Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/7b36f6f7-8dc5-47ad-8b46-791e2a0f02eb?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/7eb0640d-6b68-49eb-a183-98747def8e5b?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '859' + - '820' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:40:30 GMT + - Fri, 20 May 2022 06:36:59 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/7b36f6f7-8dc5-47ad-8b46-791e2a0f02eb/Spring/test-crud-app?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/7eb0640d-6b68-49eb-a183-98747def8e5b/Spring/test-crud-app?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -1051,9 +1199,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1198' + - '1197' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1077,27 +1225,27 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:30.6458502Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:36:59.9226469Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/866a7160-fbfe-4f7e-8d82-5516276bd8a6?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/99e15124-5f8f-4280-a61e-ba5a6cb05417?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '827' + - '809' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:40:31 GMT + - Fri, 20 May 2022 06:37:01 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/866a7160-fbfe-4f7e-8d82-5516276bd8a6/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/99e15124-5f8f-4280-a61e-ba5a6cb05417/Spring/default?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -1109,9 +1257,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1198' + - '1196' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1129,21 +1277,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/7b36f6f7-8dc5-47ad-8b46-791e2a0f02eb?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/7eb0640d-6b68-49eb-a183-98747def8e5b?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/7b36f6f7-8dc5-47ad-8b46-791e2a0f02eb","name":"7b36f6f7-8dc5-47ad-8b46-791e2a0f02eb","status":"Succeeded","startTime":"2022-03-20T06:40:30.3502985Z","endTime":"2022-03-20T06:40:37.7132311Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/7eb0640d-6b68-49eb-a183-98747def8e5b","name":"7eb0640d-6b68-49eb-a183-98747def8e5b","status":"Succeeded","startTime":"2022-05-20T06:36:59.5248279Z","endTime":"2022-05-20T06:37:05.8545793Z"}' headers: cache-control: - no-cache content-length: - - '375' + - '357' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:00 GMT + - Fri, 20 May 2022 06:37:29 GMT expires: - '-1' pragma: @@ -1161,7 +1309,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1179,21 +1327,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:29.677089Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:36:58.8132691Z"}}' headers: cache-control: - no-cache content-length: - - '860' + - '821' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:00 GMT + - Fri, 20 May 2022 06:37:31 GMT expires: - '-1' pragma: @@ -1211,9 +1359,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11997' + - '11995' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1231,21 +1379,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/866a7160-fbfe-4f7e-8d82-5516276bd8a6?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/99e15124-5f8f-4280-a61e-ba5a6cb05417?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/866a7160-fbfe-4f7e-8d82-5516276bd8a6","name":"866a7160-fbfe-4f7e-8d82-5516276bd8a6","status":"Running","startTime":"2022-03-20T06:40:31.4357044Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/99e15124-5f8f-4280-a61e-ba5a6cb05417","name":"99e15124-5f8f-4280-a61e-ba5a6cb05417","status":"Running","startTime":"2022-05-20T06:37:01.205119Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '307' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:01 GMT + - Fri, 20 May 2022 06:37:32 GMT expires: - '-1' pragma: @@ -1263,7 +1411,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1281,21 +1429,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/866a7160-fbfe-4f7e-8d82-5516276bd8a6?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/99e15124-5f8f-4280-a61e-ba5a6cb05417?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/866a7160-fbfe-4f7e-8d82-5516276bd8a6","name":"866a7160-fbfe-4f7e-8d82-5516276bd8a6","status":"Succeeded","startTime":"2022-03-20T06:40:31.4357044Z","endTime":"2022-03-20T06:41:02.6783687Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/99e15124-5f8f-4280-a61e-ba5a6cb05417","name":"99e15124-5f8f-4280-a61e-ba5a6cb05417","status":"Succeeded","startTime":"2022-05-20T06:37:01.205119Z","endTime":"2022-05-20T06:37:39.0652559Z"}' headers: cache-control: - no-cache content-length: - - '369' + - '350' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:11 GMT + - Fri, 20 May 2022 06:37:43 GMT expires: - '-1' pragma: @@ -1313,7 +1461,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1331,21 +1479,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-b5cc4b89c-dx8nq","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:40:48Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:30.6458502Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-589946f495-7bjqd","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:37:16Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:36:59.9226469Z"}}' headers: cache-control: - no-cache content-length: - - '954' + - '947' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:12 GMT + - Fri, 20 May 2022 06:37:46 GMT expires: - '-1' pragma: @@ -1365,7 +1513,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1383,21 +1531,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:29.677089Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:36:58.8132691Z"}}' headers: cache-control: - no-cache content-length: - - '860' + - '821' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:16 GMT + - Fri, 20 May 2022 06:37:51 GMT expires: - '-1' pragma: @@ -1415,9 +1563,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11996' + - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1435,21 +1583,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-b5cc4b89c-dx8nq","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:40:48Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:10.0805587Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:30.6458502Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-5c966c975-gsnhd","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"},{"name":"test-crud-app-green-13-5c966c975-x2dvs","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T06:39:57Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:39:52.2185677Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:39:52.2185677Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-crud-app-default-13-589946f495-7bjqd","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:37:16Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:57.5631735Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:36:59.9226469Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-green-13-69c4dc74d8-5km5x","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:35:57Z"},{"name":"test-crud-app-green-13-69c4dc74d8-zl45r","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:36:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":2},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:35:52.6257449Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:35:52.6257449Z"}}]}' headers: cache-control: - no-cache content-length: - - '2066' + - '2039' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:16 GMT + - Fri, 20 May 2022 06:37:54 GMT expires: - '-1' pragma: @@ -1469,7 +1617,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11997' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1487,21 +1635,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-01-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:38:25.7053649Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:40:29.677089Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app","name":"test-crud-app","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:34:21.5006354Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:36:58.8132691Z"}}' headers: cache-control: - no-cache content-length: - - '860' + - '821' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:18 GMT + - Fri, 20 May 2022 06:37:56 GMT expires: - '-1' pragma: @@ -1519,9 +1667,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11997' + - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1541,7 +1689,7 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app?api-version=2022-01-01-preview response: @@ -1549,17 +1697,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/5d05310c-154e-4319-8338-7db58067fa02?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/147bd64e-dd4d-41fb-a192-e360d83fce37?api-version=2022-01-01-preview cache-control: - no-cache content-length: - '0' date: - - Sun, 20 Mar 2022 06:41:19 GMT + - Fri, 20 May 2022 06:37:57 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/5d05310c-154e-4319-8338-7db58067fa02/Spring/test-crud-app?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/147bd64e-dd4d-41fb-a192-e360d83fce37/Spring/test-crud-app?api-version=2022-01-01-preview pragma: - no-cache request-context: @@ -1573,7 +1721,7 @@ interactions: x-ms-ratelimit-remaining-subscription-deletes: - '14999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1591,21 +1739,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/5d05310c-154e-4319-8338-7db58067fa02?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/147bd64e-dd4d-41fb-a192-e360d83fce37?api-version=2022-01-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/test-crud-app/operationId/5d05310c-154e-4319-8338-7db58067fa02","name":"5d05310c-154e-4319-8338-7db58067fa02","status":"Succeeded","startTime":"2022-03-20T06:41:20.2471621Z","endTime":"2022-03-20T06:41:29.1001787Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-crud-app/operationId/147bd64e-dd4d-41fb-a192-e360d83fce37","name":"147bd64e-dd4d-41fb-a192-e360d83fce37","status":"Succeeded","startTime":"2022-05-20T06:37:57.2227558Z","endTime":"2022-05-20T06:38:12.2752397Z"}' headers: cache-control: - no-cache content-length: - - '375' + - '357' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:41:51 GMT + - Fri, 20 May 2022 06:38:27 GMT expires: - '-1' pragma: @@ -1623,7 +1771,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK diff --git a/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml b/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml index 1546ead6be1..81e2639515a 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_blue_green_deployment.yaml @@ -13,7 +13,7 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-03-01-preview response: @@ -27,7 +27,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:21:42 GMT + - Fri, 20 May 2022 06:40:00 GMT expires: - '-1' pragma: @@ -43,7 +43,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 404 message: Not Found @@ -61,21 +61,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"1c2024b049bf488eadfcd66408a7c934","networkProfile":{"outboundIPs":{"publicIPs":["52.184.248.81","52.184.251.97"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus2","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-03-31T04:06:28.5034016Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-31T04:16:18.65197Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '766' + - '770' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:21:43 GMT + - Fri, 20 May 2022 06:40:01 GMT expires: - '-1' pragma: @@ -95,7 +95,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -118,27 +118,27 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:21:44.4564168Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:21:44.4564168Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:02.2120769Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:02.2120769Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/c06ae70e-519b-4e90-ac09-48e03d866b77?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/6245a51e-dec1-4204-8846-2a73167b2833?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '727' + - '730' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:21:44 GMT + - Fri, 20 May 2022 06:40:02 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationResults/c06ae70e-519b-4e90-ac09-48e03d866b77/Spring/test-app-blue-green?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/6245a51e-dec1-4204-8846-2a73167b2833/Spring/test-app-blue-green?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -152,7 +152,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -170,21 +170,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/c06ae70e-519b-4e90-ac09-48e03d866b77?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/6245a51e-dec1-4204-8846-2a73167b2833?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/c06ae70e-519b-4e90-ac09-48e03d866b77","name":"c06ae70e-519b-4e90-ac09-48e03d866b77","status":"Succeeded","startTime":"2022-04-01T03:21:44.7595141Z","endTime":"2022-04-01T03:21:51.5071106Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/6245a51e-dec1-4204-8846-2a73167b2833","name":"6245a51e-dec1-4204-8846-2a73167b2833","status":"Succeeded","startTime":"2022-05-20T06:40:03.0991871Z","endTime":"2022-05-20T06:40:09.4370752Z"}' headers: cache-control: - no-cache content-length: - - '364' + - '363' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:22:14 GMT + - Fri, 20 May 2022 06:40:32 GMT expires: - '-1' pragma: @@ -202,7 +202,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -220,21 +220,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:21:44.4564168Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:21:44.4564168Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:02.2120769Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:02.2120769Z"}}' headers: cache-control: - no-cache content-length: - - '830' + - '833' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:22:15 GMT + - Fri, 20 May 2022 06:40:33 GMT expires: - '-1' pragma: @@ -254,7 +254,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -279,27 +279,27 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:38.4779393Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/default/operationId/f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/8cf8757c-4b0d-4410-92fb-3e29e8b67f60?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '801' + - '805' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:22:20 GMT + - Fri, 20 May 2022 06:40:40 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationResults/f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/8cf8757c-4b0d-4410-92fb-3e29e8b67f60/Spring/default?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -311,9 +311,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1199' + - '1198' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -336,27 +336,27 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:21:44.4564168Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:21.2377054Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:02.2120769Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:40.2279464Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/82ce5ad6-559e-4af2-98d3-1eaee188d560?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/d6b96a13-6bbf-4f0c-bc1c-5d065626ddbe?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '829' + - '832' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:22:20 GMT + - Fri, 20 May 2022 06:40:40 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationResults/82ce5ad6-559e-4af2-98d3-1eaee188d560/Spring/test-app-blue-green?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/d6b96a13-6bbf-4f0c-bc1c-5d065626ddbe/Spring/test-app-blue-green?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -370,7 +370,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1198' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -388,21 +388,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/default/operationId/f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/8cf8757c-4b0d-4410-92fb-3e29e8b67f60?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/default/operationId/f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb","name":"f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb","status":"Running","startTime":"2022-04-01T03:22:20.9275915Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/8cf8757c-4b0d-4410-92fb-3e29e8b67f60","name":"8cf8757c-4b0d-4410-92fb-3e29e8b67f60","status":"Running","startTime":"2022-05-20T06:40:39.9009568Z"}' headers: cache-control: - no-cache content-length: - - '309' + - '308' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:22:51 GMT + - Fri, 20 May 2022 06:41:10 GMT expires: - '-1' pragma: @@ -420,7 +420,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -438,21 +438,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/82ce5ad6-559e-4af2-98d3-1eaee188d560?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/d6b96a13-6bbf-4f0c-bc1c-5d065626ddbe?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/82ce5ad6-559e-4af2-98d3-1eaee188d560","name":"82ce5ad6-559e-4af2-98d3-1eaee188d560","status":"Succeeded","startTime":"2022-04-01T03:22:21.629331Z","endTime":"2022-04-01T03:22:28.3560551Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/d6b96a13-6bbf-4f0c-bc1c-5d065626ddbe","name":"d6b96a13-6bbf-4f0c-bc1c-5d065626ddbe","status":"Succeeded","startTime":"2022-05-20T06:40:40.850623Z","endTime":"2022-05-20T06:40:47.3482474Z"}' headers: cache-control: - no-cache content-length: - - '363' + - '362' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:22:52 GMT + - Fri, 20 May 2022 06:41:11 GMT expires: - '-1' pragma: @@ -470,7 +470,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -488,21 +488,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:21:44.4564168Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:21.2377054Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:02.2120769Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:40.2279464Z"}}' headers: cache-control: - no-cache content-length: - - '830' + - '833' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:22:52 GMT + - Fri, 20 May 2022 06:41:12 GMT expires: - '-1' pragma: @@ -522,7 +522,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11997' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -540,21 +540,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/default/operationId/f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/8cf8757c-4b0d-4410-92fb-3e29e8b67f60?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/default/operationId/f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb","name":"f41a08fd-2b72-4e9e-a8ae-9eca0b6317bb","status":"Succeeded","startTime":"2022-04-01T03:22:20.9275915Z","endTime":"2022-04-01T03:22:56.8791242Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/8cf8757c-4b0d-4410-92fb-3e29e8b67f60","name":"8cf8757c-4b0d-4410-92fb-3e29e8b67f60","status":"Succeeded","startTime":"2022-05-20T06:40:39.9009568Z","endTime":"2022-05-20T06:41:19.7755262Z"}' headers: cache-control: - no-cache content-length: - - '352' + - '351' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:01 GMT + - Fri, 20 May 2022 06:41:20 GMT expires: - '-1' pragma: @@ -572,7 +572,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -590,21 +590,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-qgz27","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:40:43Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:38.4779393Z"}}' headers: cache-control: - no-cache content-length: - - '935' + - '949' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:02 GMT + - Fri, 20 May 2022 06:41:23 GMT expires: - '-1' pragma: @@ -622,9 +622,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11997' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -642,21 +642,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:21:44.4564168Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:21.2377054Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:02.2120769Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:40.2279464Z"}}' headers: cache-control: - no-cache content-length: - - '830' + - '833' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:07 GMT + - Fri, 20 May 2022 06:41:26 GMT expires: - '-1' pragma: @@ -676,7 +676,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11996' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -694,21 +694,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-qgz27","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:40:43Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:38.4779393Z"}}]}' headers: cache-control: - no-cache content-length: - - '947' + - '961' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:08 GMT + - Fri, 20 May 2022 06:41:29 GMT expires: - '-1' pragma: @@ -726,9 +726,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' + - '11996' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -746,21 +746,21 @@ interactions: ParameterSetName: - --app -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-05-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":0,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-qgz27","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:40:43Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:38.4779393Z"}}]}' headers: cache-control: - no-cache content-length: - - '947' + - '1366' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:11 GMT + - Fri, 20 May 2022 06:41:33 GMT expires: - '-1' pragma: @@ -778,9 +778,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11995' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -805,27 +805,27 @@ interactions: ParameterSetName: - --app -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:23:12.2162639Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":0},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:41:35.1945723Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/green/operationId/f9e57d8c-13fc-47e9-a574-89a18e1d1bb7?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/78f8d96d-7714-4374-891e-1d90f56d5763?api-version=2022-05-01-preview cache-control: - no-cache content-length: - - '798' + - '836' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:12 GMT + - Fri, 20 May 2022 06:41:35 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationResults/f9e57d8c-13fc-47e9-a574-89a18e1d1bb7/Spring/green?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/78f8d96d-7714-4374-891e-1d90f56d5763/Spring/green?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -839,7 +839,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -857,12 +857,12 @@ interactions: ParameterSetName: - --app -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/green/operationId/f9e57d8c-13fc-47e9-a574-89a18e1d1bb7?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/78f8d96d-7714-4374-891e-1d90f56d5763?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/green/operationId/f9e57d8c-13fc-47e9-a574-89a18e1d1bb7","name":"f9e57d8c-13fc-47e9-a574-89a18e1d1bb7","status":"Running","startTime":"2022-04-01T03:23:13.121062Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/78f8d96d-7714-4374-891e-1d90f56d5763","name":"78f8d96d-7714-4374-891e-1d90f56d5763","status":"Running","startTime":"2022-05-20T06:41:36.2660792Z"}' headers: cache-control: - no-cache @@ -871,7 +871,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:43 GMT + - Fri, 20 May 2022 06:42:07 GMT expires: - '-1' pragma: @@ -889,7 +889,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -907,12 +907,12 @@ interactions: ParameterSetName: - --app -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/green/operationId/f9e57d8c-13fc-47e9-a574-89a18e1d1bb7?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/78f8d96d-7714-4374-891e-1d90f56d5763?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/green/operationId/f9e57d8c-13fc-47e9-a574-89a18e1d1bb7","name":"f9e57d8c-13fc-47e9-a574-89a18e1d1bb7","status":"Succeeded","startTime":"2022-04-01T03:23:13.121062Z","endTime":"2022-04-01T03:23:52.1264842Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/78f8d96d-7714-4374-891e-1d90f56d5763","name":"78f8d96d-7714-4374-891e-1d90f56d5763","status":"Succeeded","startTime":"2022-05-20T06:41:36.2660792Z","endTime":"2022-05-20T06:42:15.8067109Z"}' headers: cache-control: - no-cache @@ -921,7 +921,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:53 GMT + - Fri, 20 May 2022 06:42:17 GMT expires: - '-1' pragma: @@ -939,7 +939,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -957,21 +957,21 @@ interactions: ParameterSetName: - --app -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:23:12.2162639Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":0,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-dddbc7b77-l9pzn","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:41:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:41:35.1945723Z"}}' headers: cache-control: - no-cache content-length: - - '941' + - '1348' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:54 GMT + - Fri, 20 May 2022 06:42:20 GMT expires: - '-1' pragma: @@ -989,9 +989,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' + - '11994' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1009,21 +1009,21 @@ interactions: ParameterSetName: - --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:22:20.1595781Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:23:12.2162639Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-qgz27","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:40:43Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:40:38.4779393Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-dddbc7b77-l9pzn","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:41:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:41:35.1945723Z"}}]}' headers: cache-control: - no-cache content-length: - - '1889' + - '1905' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:57 GMT + - Fri, 20 May 2022 06:42:24 GMT expires: - '-1' pragma: @@ -1041,9 +1041,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11994' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1061,21 +1061,21 @@ interactions: ParameterSetName: - -d -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:23:12.2162639Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-dddbc7b77-l9pzn","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:41:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:41:35.1945723Z"}}' headers: cache-control: - no-cache content-length: - - '941' + - '943' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:23:59 GMT + - Fri, 20 May 2022 06:42:28 GMT expires: - '-1' pragma: @@ -1095,7 +1095,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1113,21 +1113,21 @@ interactions: ParameterSetName: - -d -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-01-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"1c2024b049bf488eadfcd66408a7c934","networkProfile":{"outboundIPs":{"publicIPs":["52.184.248.81","52.184.251.97"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus2","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-03-31T04:06:28.5034016Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-31T04:16:18.65197Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '766' + - '770' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:01 GMT + - Fri, 20 May 2022 06:42:28 GMT expires: - '-1' pragma: @@ -1145,9 +1145,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1169,27 +1169,27 @@ interactions: ParameterSetName: - -d -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2020-07-01 response: body: - string: '{"properties":{"public":false,"provisioningState":"Updating","activeDeploymentName":"green","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-04-01T03:21:51.473Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' + string: '{"properties":{"public":false,"provisioningState":"Updating","activeDeploymentName":"green","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-05-20T06:40:09.366Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/b26759e0-8bc9-4afc-bb14-67d4cc1fb94a?api-version=2020-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/401209c1-a7fb-47fc-a9b0-67807449f4ab?api-version=2020-07-01 cache-control: - no-cache content-length: - - '568' + - '567' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:03 GMT + - Fri, 20 May 2022 06:42:30 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationResults/b26759e0-8bc9-4afc-bb14-67d4cc1fb94a/Spring/test-app-blue-green?api-version=2020-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/401209c1-a7fb-47fc-a9b0-67807449f4ab/Spring/test-app-blue-green?api-version=2020-07-01 pragma: - no-cache request-context: @@ -1203,7 +1203,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1221,21 +1221,21 @@ interactions: ParameterSetName: - -d -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/b26759e0-8bc9-4afc-bb14-67d4cc1fb94a?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/401209c1-a7fb-47fc-a9b0-67807449f4ab?api-version=2020-07-01 response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/b26759e0-8bc9-4afc-bb14-67d4cc1fb94a","name":"b26759e0-8bc9-4afc-bb14-67d4cc1fb94a","status":"Succeeded","startTime":"2022-04-01T03:24:03.9346991Z","endTime":"2022-04-01T03:24:10.4669942Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/401209c1-a7fb-47fc-a9b0-67807449f4ab","name":"401209c1-a7fb-47fc-a9b0-67807449f4ab","status":"Succeeded","startTime":"2022-05-20T06:42:30.7066596Z","endTime":"2022-05-20T06:42:37.4736528Z"}' headers: cache-control: - no-cache content-length: - - '364' + - '363' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:36 GMT + - Fri, 20 May 2022 06:43:00 GMT expires: - '-1' pragma: @@ -1253,7 +1253,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1271,21 +1271,21 @@ interactions: ParameterSetName: - -d -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2020-07-01 response: body: - string: '{"properties":{"public":false,"provisioningState":"Succeeded","activeDeploymentName":"green","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-04-01T03:21:51.473Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' + string: '{"properties":{"public":false,"provisioningState":"Succeeded","activeDeploymentName":"green","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-05-20T06:40:09.366Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' headers: cache-control: - no-cache content-length: - - '569' + - '568' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:36 GMT + - Fri, 20 May 2022 06:43:01 GMT expires: - '-1' pragma: @@ -1305,7 +1305,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1323,21 +1323,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:21:44.4564168Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:02.2120769Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}}' headers: cache-control: - no-cache content-length: - - '830' + - '833' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:39 GMT + - Fri, 20 May 2022 06:43:04 GMT expires: - '-1' pragma: @@ -1355,9 +1355,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11995' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1375,21 +1375,23 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-khhqv","status":"Starting","reason":"Not + ready for connecting","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:42:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-dddbc7b77-jtpb5","status":"Starting","reason":"Not + ready for connecting","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:42:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}}]}' headers: cache-control: - no-cache content-length: - - '1889' + - '1979' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:40 GMT + - Fri, 20 May 2022 06:43:06 GMT expires: - '-1' pragma: @@ -1407,9 +1409,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11995' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1427,21 +1429,21 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-khhqv","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:42:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}}' headers: cache-control: - no-cache content-length: - - '948' + - '950' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:43 GMT + - Fri, 20 May 2022 06:43:11 GMT expires: - '-1' pragma: @@ -1459,9 +1461,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11996' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1479,21 +1481,21 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-dddbc7b77-jtpb5","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:42:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}}' headers: cache-control: - no-cache content-length: - - '928' + - '942' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:45 GMT + - Fri, 20 May 2022 06:43:14 GMT expires: - '-1' pragma: @@ -1513,7 +1515,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1531,21 +1533,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"UP","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-khhqv","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:42:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}},{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-app-blue-green-green-19-dddbc7b77-jtpb5","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:42:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}}]}' headers: cache-control: - no-cache content-length: - - '1889' + - '1905' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:47 GMT + - Fri, 20 May 2022 06:43:18 GMT expires: - '-1' pragma: @@ -1563,9 +1565,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11993' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1583,21 +1585,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-01-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"1c2024b049bf488eadfcd66408a7c934","networkProfile":{"outboundIPs":{"publicIPs":["52.184.248.81","52.184.251.97"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus2","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-03-31T04:06:28.5034016Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-31T04:16:18.65197Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '766' + - '770' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:49 GMT + - Fri, 20 May 2022 06:43:21 GMT expires: - '-1' pragma: @@ -1617,7 +1619,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1639,27 +1641,27 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2020-07-01 response: body: - string: '{"properties":{"public":false,"provisioningState":"Updating","activeDeploymentName":"","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-04-01T03:21:51.473Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' + string: '{"properties":{"public":false,"provisioningState":"Updating","activeDeploymentName":"","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-05-20T06:40:09.366Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/1458976d-cbb0-43b8-8ea1-737c31598072?api-version=2020-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/43bc2a9d-06cb-438d-b6b4-e47425813952?api-version=2020-07-01 cache-control: - no-cache content-length: - - '563' + - '562' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:24:52 GMT + - Fri, 20 May 2022 06:43:23 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationResults/1458976d-cbb0-43b8-8ea1-737c31598072/Spring/test-app-blue-green?api-version=2020-07-01 + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/43bc2a9d-06cb-438d-b6b4-e47425813952/Spring/test-app-blue-green?api-version=2020-07-01 pragma: - no-cache request-context: @@ -1673,7 +1675,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1691,21 +1693,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/1458976d-cbb0-43b8-8ea1-737c31598072?api-version=2020-07-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/43bc2a9d-06cb-438d-b6b4-e47425813952?api-version=2020-07-01 response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/1458976d-cbb0-43b8-8ea1-737c31598072","name":"1458976d-cbb0-43b8-8ea1-737c31598072","status":"Succeeded","startTime":"2022-04-01T03:24:52.1239918Z","endTime":"2022-04-01T03:24:59.5951309Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/43bc2a9d-06cb-438d-b6b4-e47425813952","name":"43bc2a9d-06cb-438d-b6b4-e47425813952","status":"Succeeded","startTime":"2022-05-20T06:43:23.7089408Z","endTime":"2022-05-20T06:43:31.054994Z"}' headers: cache-control: - no-cache content-length: - - '364' + - '362' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:25:22 GMT + - Fri, 20 May 2022 06:43:53 GMT expires: - '-1' pragma: @@ -1723,7 +1725,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1741,21 +1743,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2020-07-01 response: body: - string: '{"properties":{"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-04-01T03:21:51.473Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' + string: '{"properties":{"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"createdTime":"2022-05-20T06:40:09.366Z","temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"}},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green"}' headers: cache-control: - no-cache content-length: - - '538' + - '537' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:25:23 GMT + - Fri, 20 May 2022 06:43:54 GMT expires: - '-1' pragma: @@ -1775,7 +1777,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1793,21 +1795,21 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-76cf66d844-x8fk2","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:22:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:22:20.1595781Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:02.8097207Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-default-19-794d794fc9-khhqv","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:42:37Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:38.4779393Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:42:30.1851103Z"}}' headers: cache-control: - no-cache content-length: - - '948' + - '950' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:25:24 GMT + - Fri, 20 May 2022 06:43:58 GMT expires: - '-1' pragma: @@ -1825,9 +1827,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1845,21 +1847,21 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-88c9fd88d-65m75","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-04-01T03:23:18Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:23:12.2162639Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:50.9312682Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-app-blue-green-green-19-dddbc7b77-494nf","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:43:30Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:41:35.1945723Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:43:22.2811787Z"}}' headers: cache-control: - no-cache content-length: - - '941' + - '943' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:25:28 GMT + - Fri, 20 May 2022 06:44:04 GMT expires: - '-1' pragma: @@ -1879,7 +1881,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1897,21 +1899,21 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-01-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus2","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"yuwzho@microsoft.com","createdByType":"User","createdAt":"2022-04-01T03:21:44.4564168Z","lastModifiedBy":"yuwzho@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-04-01T03:24:50.9312682Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green","name":"test-app-blue-green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:40:02.2120769Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:43:22.2811787Z"}}' headers: cache-control: - no-cache content-length: - - '830' + - '833' content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:25:29 GMT + - Fri, 20 May 2022 06:44:06 GMT expires: - '-1' pragma: @@ -1929,9 +1931,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1951,7 +1953,7 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: DELETE uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-app-blue-green?api-version=2022-01-01-preview response: @@ -1959,17 +1961,17 @@ interactions: string: '' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/82bbe399-ccc8-4244-b45c-c03a31f02699?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/2784912c-6a72-457a-89ee-532d94f8db47?api-version=2022-01-01-preview cache-control: - no-cache content-length: - '0' date: - - Fri, 01 Apr 2022 03:25:30 GMT + - Fri, 20 May 2022 06:44:07 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationResults/82bbe399-ccc8-4244-b45c-c03a31f02699/Spring/test-app-blue-green?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/2784912c-6a72-457a-89ee-532d94f8db47/Spring/test-app-blue-green?api-version=2022-01-01-preview pragma: - no-cache request-context: @@ -1983,7 +1985,7 @@ interactions: x-ms-ratelimit-remaining-subscription-deletes: - '14999' x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -2001,12 +2003,12 @@ interactions: ParameterSetName: - -n -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.2 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/82bbe399-ccc8-4244-b45c-c03a31f02699?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/2784912c-6a72-457a-89ee-532d94f8db47?api-version=2022-01-01-preview response: body: - string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus2/operationStatus/test-app-blue-green/operationId/82bbe399-ccc8-4244-b45c-c03a31f02699","name":"82bbe399-ccc8-4244-b45c-c03a31f02699","status":"Succeeded","startTime":"2022-04-01T03:25:31.10281Z","endTime":"2022-04-01T03:25:39.8293617Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-app-blue-green/operationId/2784912c-6a72-457a-89ee-532d94f8db47","name":"2784912c-6a72-457a-89ee-532d94f8db47","status":"Succeeded","startTime":"2022-05-20T06:44:07.8232149Z","endTime":"2022-05-20T06:44:16.516334Z"}' headers: cache-control: - no-cache @@ -2015,7 +2017,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Fri, 01 Apr 2022 03:26:01 GMT + - Fri, 20 May 2022 06:44:38 GMT expires: - '-1' pragma: @@ -2033,7 +2035,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - c2822230-ebfa-4dc3-a1f8-e0c2ce642143 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK diff --git a/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml b/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml index 8cc215afceb..eb1810947e6 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml @@ -13,22 +13,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-01-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 - 02:02:01 +0800","service-expire-time":"2022-03-20 13:02:01 +0800"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","createdByType":"Application","createdAt":"2022-03-19T18:02:10.1198327Z","lastModifiedBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","lastModifiedByType":"Application","lastModifiedAt":"2022-03-19T19:56:42.9425082Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '1011' + - '770' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:11 GMT + - Fri, 20 May 2022 06:25:28 GMT expires: - '-1' pragma: @@ -46,9 +45,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11997' + - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -66,7 +65,7 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: @@ -76,11 +75,11 @@ interactions: cache-control: - no-cache content-length: - - '246' + - '220' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:13 GMT + - Fri, 20 May 2022 06:25:29 GMT expires: - '-1' pragma: @@ -96,7 +95,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 404 message: Not Found @@ -114,22 +113,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 - 02:02:01 +0800","service-expire-time":"2022-03-20 13:02:01 +0800"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","createdByType":"Application","createdAt":"2022-03-19T18:02:10.1198327Z","lastModifiedBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","lastModifiedByType":"Application","lastModifiedAt":"2022-03-19T19:56:42.9425082Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '1011' + - '770' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:13 GMT + - Fri, 20 May 2022 06:25:30 GMT expires: - '-1' pragma: @@ -149,7 +147,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -172,27 +170,27 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:14.6362979Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:25:31.3298235Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/0f299360-fc5b-44d9-9335-013fca4d08fc?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/2b35d865-b454-4169-9f60-9831c485499f?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '729' + - '704' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:15 GMT + - Fri, 20 May 2022 06:25:31 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/0f299360-fc5b-44d9-9335-013fca4d08fc/Spring/deploy?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/2b35d865-b454-4169-9f60-9831c485499f/Spring/deploy?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -206,7 +204,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -224,21 +222,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/0f299360-fc5b-44d9-9335-013fca4d08fc?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/2b35d865-b454-4169-9f60-9831c485499f?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/0f299360-fc5b-44d9-9335-013fca4d08fc","name":"0f299360-fc5b-44d9-9335-013fca4d08fc","status":"Succeeded","startTime":"2022-03-20T06:26:15.4412769Z","endTime":"2022-03-20T06:26:23.4984636Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/2b35d865-b454-4169-9f60-9831c485499f","name":"2b35d865-b454-4169-9f60-9831c485499f","status":"Succeeded","startTime":"2022-05-20T06:25:32.0778771Z","endTime":"2022-05-20T06:25:38.5423032Z"}' headers: cache-control: - no-cache content-length: - - '368' + - '350' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:45 GMT + - Fri, 20 May 2022 06:26:02 GMT expires: - '-1' pragma: @@ -256,7 +254,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -274,21 +272,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:14.6362979Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:25:31.3298235Z"}}' headers: cache-control: - no-cache content-length: - - '847' + - '807' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:45 GMT + - Fri, 20 May 2022 06:26:03 GMT expires: - '-1' pragma: @@ -308,7 +306,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -333,27 +331,27 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:50.7614162Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:26:07.4392301Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/864ae0a7-d932-4343-ad82-646679539e88?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/678c743a-c20c-46fa-b96c-01b6ac737eb4?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '820' + - '802' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:53 GMT + - Fri, 20 May 2022 06:26:08 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/864ae0a7-d932-4343-ad82-646679539e88/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/678c743a-c20c-46fa-b96c-01b6ac737eb4/Spring/default?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -365,9 +363,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1199' + - '1198' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -390,27 +388,27 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:54.2926751Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:26:08.9548856Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/f95aaa62-cfe7-414d-9a22-a513680e8495?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/56f4ca16-e893-4f65-a192-0b637246b58b?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '846' + - '806' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:26:55 GMT + - Fri, 20 May 2022 06:26:10 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/f95aaa62-cfe7-414d-9a22-a513680e8495/Spring/deploy?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/56f4ca16-e893-4f65-a192-0b637246b58b/Spring/deploy?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -424,7 +422,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1198' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -442,21 +440,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/864ae0a7-d932-4343-ad82-646679539e88?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/678c743a-c20c-46fa-b96c-01b6ac737eb4?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/864ae0a7-d932-4343-ad82-646679539e88","name":"864ae0a7-d932-4343-ad82-646679539e88","status":"Succeeded","startTime":"2022-03-20T06:26:53.9576895Z","endTime":"2022-03-20T06:27:12.3145561Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/678c743a-c20c-46fa-b96c-01b6ac737eb4","name":"678c743a-c20c-46fa-b96c-01b6ac737eb4","status":"Running","startTime":"2022-05-20T06:26:08.6291561Z"}' headers: cache-control: - no-cache content-length: - - '369' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:23 GMT + - Fri, 20 May 2022 06:26:38 GMT expires: - '-1' pragma: @@ -474,7 +472,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -492,21 +490,71 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/56f4ca16-e893-4f65-a192-0b637246b58b?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"deploy-default-6-794dcc447c-b9hk2","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:26:59Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:50.7614162Z"}}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/56f4ca16-e893-4f65-a192-0b637246b58b","name":"56f4ca16-e893-4f65-a192-0b637246b58b","status":"Succeeded","startTime":"2022-05-20T06:26:11.2801572Z","endTime":"2022-05-20T06:26:17.6104521Z"}' headers: cache-control: - no-cache content-length: - - '940' + - '350' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:24 GMT + - Fri, 20 May 2022 06:26:41 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app create + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --cpu --env --runtime-version + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview + response: + body: + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:26:08.9548856Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '807' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:26:41 GMT expires: - '-1' pragma: @@ -524,9 +572,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11997' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -544,21 +592,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/f95aaa62-cfe7-414d-9a22-a513680e8495?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/678c743a-c20c-46fa-b96c-01b6ac737eb4?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/f95aaa62-cfe7-414d-9a22-a513680e8495","name":"f95aaa62-cfe7-414d-9a22-a513680e8495","status":"Succeeded","startTime":"2022-03-20T06:26:56.4735363Z","endTime":"2022-03-20T06:27:02.77413Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/678c743a-c20c-46fa-b96c-01b6ac737eb4","name":"678c743a-c20c-46fa-b96c-01b6ac737eb4","status":"Running","startTime":"2022-05-20T06:26:08.6291561Z"}' headers: cache-control: - no-cache content-length: - - '366' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:26 GMT + - Fri, 20 May 2022 06:26:48 GMT expires: - '-1' pragma: @@ -576,7 +624,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -594,21 +642,71 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/678c743a-c20c-46fa-b96c-01b6ac737eb4?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/678c743a-c20c-46fa-b96c-01b6ac737eb4","name":"678c743a-c20c-46fa-b96c-01b6ac737eb4","status":"Succeeded","startTime":"2022-05-20T06:26:08.6291561Z","endTime":"2022-05-20T06:26:49.8717817Z"}' + headers: + cache-control: + - no-cache + content-length: + - '351' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:27:01 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app create + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --cpu --env --runtime-version + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:54.2926751Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"deploy-default-6-75cb99bf64-h8995","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:26:16Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:26:07.4392301Z"}}' headers: cache-control: - no-cache content-length: - - '847' + - '932' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:26 GMT + - Fri, 20 May 2022 06:27:04 GMT expires: - '-1' pragma: @@ -626,9 +724,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11997' + - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -646,21 +744,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:54.2926751Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:26:08.9548856Z"}}' headers: cache-control: - no-cache content-length: - - '847' + - '807' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:31 GMT + - Fri, 20 May 2022 06:27:07 GMT expires: - '-1' pragma: @@ -680,7 +778,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11996' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -698,21 +796,21 @@ interactions: ParameterSetName: - -n -g -s --cpu --env --runtime-version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"deploy-default-6-794dcc447c-b9hk2","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:26:59Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:50.7614162Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"deploy-default-6-75cb99bf64-h8995","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:26:16Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:26:07.4392301Z"}}]}' headers: cache-control: - no-cache content-length: - - '952' + - '944' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:31 GMT + - Fri, 20 May 2022 06:27:10 GMT expires: - '-1' pragma: @@ -732,7 +830,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -750,21 +848,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"deploy-default-6-794dcc447c-b9hk2","status":"Running","discoveryStatus":"UP","startTime":"2022-03-20T06:26:59Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:26:50.7614162Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"deploy-default-6-75cb99bf64-h8995","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:26:16Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:26:07.4392301Z"}}]}' headers: cache-control: - no-cache content-length: - - '952' + - '944' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:37 GMT + - Fri, 20 May 2022 06:27:14 GMT expires: - '-1' pragma: @@ -784,7 +882,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -804,21 +902,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-05-01-preview response: body: - string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","uploadUrl":"https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802?sv=2018-03-28&sr=f&sig=De1%2BDkJxr1oOMnvoX3Vr80YdKnkCRM76XtoLpjnN4iE%3D&se=2022-03-20T08%3A27%3A39Z&sp=w"}' + string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","uploadUrl":"https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?sv=2018-03-28&sr=f&sig=83T6craO99vLH46Td8kAJLnfMTEXy9Hcl%2FTF0pe%2Bvyk%3D&se=2022-05-20T08%3A27%3A17Z&sp=w"}' headers: cache-control: - no-cache content-length: - - '471' + - '473' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:39 GMT + - Fri, 20 May 2022 06:27:18 GMT expires: - '-1' pragma: @@ -836,9 +934,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -850,17 +948,17 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.9.5; Windows 10) + - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) x-ms-content-length: - '11' x-ms-date: - - Sun, 20 Mar 2022 06:27:39 GMT + - Fri, 20 May 2022 06:27:18 GMT x-ms-file-attributes: - Archive x-ms-file-creation-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-last-write-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-permission: - Inherit x-ms-type: @@ -868,7 +966,7 @@ interactions: x-ms-version: - '2019-02-02' method: PUT - uri: https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802?sv=2018-03-28&sr=f&sig=De1%2BDkJxr1oOMnvoX3Vr80YdKnkCRM76XtoLpjnN4iE%3D&se=2022-03-20T08%3A27%3A39Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?sv=2018-03-28&sr=f&sig=83T6craO99vLH46Td8kAJLnfMTEXy9Hcl%2FTF0pe%2Bvyk%3D&se=2022-05-20T08%3A27%3A17Z&sp=w response: body: string: '' @@ -876,27 +974,27 @@ interactions: content-length: - '0' date: - - Sun, 20 Mar 2022 06:27:39 GMT + - Fri, 20 May 2022 06:27:19 GMT etag: - - '"0x8DA0A3ABB88B782"' + - '"0x8DA3A29C9E01FB8"' last-modified: - - Sun, 20 Mar 2022 06:27:39 GMT + - Fri, 20 May 2022 06:27:18 GMT server: - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 x-ms-file-attributes: - Archive x-ms-file-change-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-creation-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-id: - - '11529335992347525120' + - '10376363910205800448' x-ms-file-last-write-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-parent-id: - '13835128424026341376' x-ms-file-permission-key: - - 11807555321441796965*827594984623582187 + - 2538703833122030037*10059812236488386907 x-ms-request-server-encrypted: - 'true' x-ms-version: @@ -912,9 +1010,9 @@ interactions: Content-Length: - '11' User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.9.5; Windows 10) + - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) x-ms-date: - - Sun, 20 Mar 2022 06:27:40 GMT + - Fri, 20 May 2022 06:27:19 GMT x-ms-range: - bytes=0-10 x-ms-version: @@ -922,7 +1020,7 @@ interactions: x-ms-write: - update method: PUT - uri: https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802?comp=range&sv=2018-03-28&sr=f&sig=De1%2BDkJxr1oOMnvoX3Vr80YdKnkCRM76XtoLpjnN4iE%3D&se=2022-03-20T08%3A27%3A39Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?comp=range&sv=2018-03-28&sr=f&sig=83T6craO99vLH46Td8kAJLnfMTEXy9Hcl%2FTF0pe%2Bvyk%3D&se=2022-05-20T08%3A27%3A17Z&sp=w response: body: string: '' @@ -932,11 +1030,11 @@ interactions: content-md5: - 99EB7GGDEcq+ZSyODG3erA== date: - - Sun, 20 Mar 2022 06:27:39 GMT + - Fri, 20 May 2022 06:27:19 GMT etag: - - '"0x8DA0A3ABBF053B7"' + - '"0x8DA3A29CADFD3B3"' last-modified: - - Sun, 20 Mar 2022 06:27:40 GMT + - Fri, 20 May 2022 06:27:19 GMT server: - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-server-encrypted: @@ -948,7 +1046,7 @@ interactions: message: Created - request: body: '{"properties": {"source": {"type": "Jar", "version": "v1", "relativePath": - "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802", + "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad", "runtimeVersion": "Java_11"}, "deploymentSettings": {}}, "sku": {"name": "S0", "tier": "Standard"}}' headers: @@ -967,27 +1065,27 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","version":"v1","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:27:41.2858295Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","version":"v1","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"},"terminationGracePeriodSeconds":0},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:27:20.7482888Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/adac135f-1959-47e3-9e03-f902492d205a?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/c77a3a14-fcd9-4d45-87f1-c5d98b093e53?api-version=2022-05-01-preview cache-control: - no-cache content-length: - - '948' + - '964' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:27:41 GMT + - Fri, 20 May 2022 06:27:23 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/adac135f-1959-47e3-9e03-f902492d205a/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/c77a3a14-fcd9-4d45-87f1-c5d98b093e53/Spring/default?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -1001,7 +1099,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1019,21 +1117,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/adac135f-1959-47e3-9e03-f902492d205a?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/c77a3a14-fcd9-4d45-87f1-c5d98b093e53?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/adac135f-1959-47e3-9e03-f902492d205a","name":"adac135f-1959-47e3-9e03-f902492d205a","status":"Running","startTime":"2022-03-20T06:27:42.3722091Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/c77a3a14-fcd9-4d45-87f1-c5d98b093e53","name":"c77a3a14-fcd9-4d45-87f1-c5d98b093e53","status":"Running","startTime":"2022-05-20T06:27:23.5172907Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:11 GMT + - Fri, 20 May 2022 06:27:54 GMT expires: - '-1' pragma: @@ -1051,7 +1149,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1069,23 +1167,23 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/adac135f-1959-47e3-9e03-f902492d205a?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/c77a3a14-fcd9-4d45-87f1-c5d98b093e53?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/adac135f-1959-47e3-9e03-f902492d205a","name":"adac135f-1959-47e3-9e03-f902492d205a","status":"Failed","startTime":"2022-03-20T06:27:42.3722091Z","endTime":"2022-03-20T06:28:22.1783019Z","error":{"code":"BadRequest","message":"112404: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/c77a3a14-fcd9-4d45-87f1-c5d98b093e53","name":"c77a3a14-fcd9-4d45-87f1-c5d98b093e53","status":"Failed","startTime":"2022-05-20T06:27:23.5172907Z","endTime":"2022-05-20T06:28:01.2964564Z","error":{"code":"BadRequest","message":"112404: Failed to wait for deployment instances to be ready. Please check the application - log (see https://aka.ms/azure-spring-doc-log ), and try again later."}}' + log (see https://aka.ms/azure-spring-cloud-doc-log ), and try again later."}}' headers: cache-control: - no-cache content-length: - - '573' + - '555' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:23 GMT + - Fri, 20 May 2022 06:28:04 GMT expires: - '-1' pragma: @@ -1103,7 +1201,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1121,22 +1219,22 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","version":"v1","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-546f77cc5d-ccvdc","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:27:54Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:27:41.2858295Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","version":"v1","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-79bd74cccd-x4vlr","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:27:35Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:27:20.7482888Z"}}' headers: cache-control: - no-cache content-length: - - '1132' + - '1122' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:24 GMT + - Fri, 20 May 2022 06:28:08 GMT expires: - '-1' pragma: @@ -1154,9 +1252,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11996' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1174,22 +1272,22 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","version":"v1","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-546f77cc5d-ccvdc","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:27:54Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:27:41.2858295Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","version":"v1","runtimeVersion":"Java_11"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"foo":"bar"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-79bd74cccd-x4vlr","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:27:35Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:27:20.7482888Z"}}]}' headers: cache-control: - no-cache content-length: - - '1144' + - '1134' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:25 GMT + - Fri, 20 May 2022 06:28:12 GMT expires: - '-1' pragma: @@ -1209,7 +1307,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1227,22 +1325,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-01-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 - 02:02:01 +0800","service-expire-time":"2022-03-20 13:02:01 +0800"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","createdByType":"Application","createdAt":"2022-03-19T18:02:10.1198327Z","lastModifiedBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","lastModifiedByType":"Application","lastModifiedAt":"2022-03-19T19:56:42.9425082Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '1011' + - '770' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:27 GMT + - Fri, 20 May 2022 06:28:14 GMT expires: - '-1' pragma: @@ -1262,7 +1359,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1284,27 +1381,27 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:28:28.652305Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:28:16.4106684Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/e39e52da-1888-4b3a-80f4-b1d012b0cd4c?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/39adde7b-8e1d-44b4-9657-8d7459069434?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '845' + - '806' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:28 GMT + - Fri, 20 May 2022 06:28:17 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/e39e52da-1888-4b3a-80f4-b1d012b0cd4c/Spring/deploy?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/39adde7b-8e1d-44b4-9657-8d7459069434/Spring/deploy?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -1318,13 +1415,13 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted - request: body: '{"properties": {"source": {"type": "Jar", "version": "v1", "relativePath": - "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802", + "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad", "runtimeVersion": "Java_8"}, "deploymentSettings": {"environmentVariables": {"bas": "baz"}}}, "sku": {"name": "S0", "tier": "Standard"}}' headers: @@ -1343,27 +1440,27 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:28:29.6054354Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:28:18.1294566Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0857a9d1-0f68-40b4-9900-3265c3f65463?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '947' + - '929' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:29 GMT + - Fri, 20 May 2022 06:28:20 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/0857a9d1-0f68-40b4-9900-3265c3f65463/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4/Spring/default?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -1377,7 +1474,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1395,21 +1492,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/e39e52da-1888-4b3a-80f4-b1d012b0cd4c?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/39adde7b-8e1d-44b4-9657-8d7459069434?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/e39e52da-1888-4b3a-80f4-b1d012b0cd4c","name":"e39e52da-1888-4b3a-80f4-b1d012b0cd4c","status":"Succeeded","startTime":"2022-03-20T06:28:29.2895019Z","endTime":"2022-03-20T06:28:35.8517308Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/39adde7b-8e1d-44b4-9657-8d7459069434","name":"39adde7b-8e1d-44b4-9657-8d7459069434","status":"Succeeded","startTime":"2022-05-20T06:28:17.6090389Z","endTime":"2022-05-20T06:28:25.1526405Z"}' headers: cache-control: - no-cache content-length: - - '368' + - '350' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:28:59 GMT + - Fri, 20 May 2022 06:28:50 GMT expires: - '-1' pragma: @@ -1427,7 +1524,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1445,21 +1542,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:28:28.652305Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:28:16.4106684Z"}}' headers: cache-control: - no-cache content-length: - - '846' + - '807' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:00 GMT + - Fri, 20 May 2022 06:28:51 GMT expires: - '-1' pragma: @@ -1479,7 +1576,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1497,21 +1594,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0857a9d1-0f68-40b4-9900-3265c3f65463?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0857a9d1-0f68-40b4-9900-3265c3f65463","name":"0857a9d1-0f68-40b4-9900-3265c3f65463","status":"Running","startTime":"2022-03-20T06:28:30.3900396Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","name":"7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","status":"Running","startTime":"2022-05-20T06:28:20.7191748Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:00 GMT + - Fri, 20 May 2022 06:28:53 GMT expires: - '-1' pragma: @@ -1529,7 +1626,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1547,23 +1644,273 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0857a9d1-0f68-40b4-9900-3265c3f65463?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0857a9d1-0f68-40b4-9900-3265c3f65463","name":"0857a9d1-0f68-40b4-9900-3265c3f65463","status":"Failed","startTime":"2022-03-20T06:28:30.3900396Z","endTime":"2022-03-20T06:29:08.1947552Z","error":{"code":"BadRequest","message":"112404: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","name":"7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","status":"Running","startTime":"2022-05-20T06:28:20.7191748Z"}' + headers: + cache-control: + - no-cache + content-length: + - '308' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:29:03 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app update + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --runtime-version --env + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","name":"7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","status":"Running","startTime":"2022-05-20T06:28:20.7191748Z"}' + headers: + cache-control: + - no-cache + content-length: + - '308' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:29:14 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app update + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --runtime-version --env + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","name":"7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","status":"Running","startTime":"2022-05-20T06:28:20.7191748Z"}' + headers: + cache-control: + - no-cache + content-length: + - '308' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:29:24 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app update + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --runtime-version --env + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","name":"7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","status":"Running","startTime":"2022-05-20T06:28:20.7191748Z"}' + headers: + cache-control: + - no-cache + content-length: + - '308' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:29:34 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app update + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --runtime-version --env + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","name":"7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","status":"Running","startTime":"2022-05-20T06:28:20.7191748Z"}' + headers: + cache-control: + - no-cache + content-length: + - '308' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:29:45 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app update + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --runtime-version --env + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","name":"7bbf04a8-7ef9-4b25-8d55-78124c2dd3e4","status":"Failed","startTime":"2022-05-20T06:28:20.7191748Z","endTime":"2022-05-20T06:29:53.8917641Z","error":{"code":"BadRequest","message":"112404: Failed to wait for deployment instances to be ready. Please check the application - log (see https://aka.ms/azure-spring-doc-log ), and try again later."}}' + log (see https://aka.ms/azure-spring-cloud-doc-log ), and try again later."}}' headers: cache-control: - no-cache content-length: - - '573' + - '555' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:11 GMT + - Fri, 20 May 2022 06:29:57 GMT expires: - '-1' pragma: @@ -1581,7 +1928,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1599,21 +1946,21 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:28:28.652305Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:28:16.4106684Z"}}' headers: cache-control: - no-cache content-length: - - '846' + - '807' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:15 GMT + - Fri, 20 May 2022 06:30:01 GMT expires: - '-1' pragma: @@ -1631,9 +1978,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' + - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1651,22 +1998,22 @@ interactions: ParameterSetName: - -n -g -s --runtime-version --env User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-69546cc7b4-wzxkg","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:28:42Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:28:29.6054354Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-7c8f5f6dcc-zj5q7","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:28:33Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:28:18.1294566Z"}}]}' headers: cache-control: - no-cache content-length: - - '1143' + - '1133' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:16 GMT + - Fri, 20 May 2022 06:30:05 GMT expires: - '-1' pragma: @@ -1686,7 +2033,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1704,22 +2051,22 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-69546cc7b4-wzxkg","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:28:42Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:28:29.6054354Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-7c8f5f6dcc-zj5q7","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:28:33Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:28:18.1294566Z"}}' headers: cache-control: - no-cache content-length: - - '1131' + - '1121' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:17 GMT + - Fri, 20 May 2022 06:30:09 GMT expires: - '-1' pragma: @@ -1739,7 +2086,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1757,22 +2104,22 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-30ee701f-5830-48d3-a13f-40707754d802","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-69546cc7b4-wzxkg","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:28:42Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:28:29.6054354Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","version":"v1","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-7c8f5f6dcc-zj5q7","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:28:33Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:28:18.1294566Z"}}]}' headers: cache-control: - no-cache content-length: - - '1143' + - '1133' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:21 GMT + - Fri, 20 May 2022 06:30:14 GMT expires: - '-1' pragma: @@ -1790,9 +2137,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1810,22 +2157,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-01-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 - 02:02:01 +0800","service-expire-time":"2022-03-20 13:02:01 +0800"},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","createdByType":"Application","createdAt":"2022-03-19T18:02:10.1198327Z","lastModifiedBy":"3462cf92-dc17-43c5-8c7e-e50c11a1c181","lastModifiedByType":"Application","lastModifiedAt":"2022-03-19T19:56:42.9425082Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '1011' + - '770' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:22 GMT + - Fri, 20 May 2022 06:30:16 GMT expires: - '-1' pragma: @@ -1843,9 +2189,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11996' + - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1865,21 +2211,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-05-01-preview response: body: - string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","uploadUrl":"https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826?sv=2018-03-28&sr=f&sig=ZshAYB8PCczY6GxQFF%2FGfoER2cAqMpo2ice2ka4k14Q%3D&se=2022-03-20T08%3A29%3A24Z&sp=w"}' + string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","uploadUrl":"https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240?sv=2018-03-28&sr=f&sig=BbBA%2BLMN1cx5%2BVDCSWmki%2BDwCvhY3bVYVXQvDcZalgg%3D&se=2022-05-20T08%3A30%3A19Z&sp=w"}' headers: cache-control: - no-cache content-length: - - '471' + - '475' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:24 GMT + - Fri, 20 May 2022 06:30:19 GMT expires: - '-1' pragma: @@ -1897,9 +2243,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-writes: - - '1199' + - '1198' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1911,17 +2257,17 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.9.5; Windows 10) + - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) x-ms-content-length: - '11' x-ms-date: - - Sun, 20 Mar 2022 06:29:24 GMT + - Fri, 20 May 2022 06:30:19 GMT x-ms-file-attributes: - Archive x-ms-file-creation-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-last-write-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-permission: - Inherit x-ms-type: @@ -1929,7 +2275,7 @@ interactions: x-ms-version: - '2019-02-02' method: PUT - uri: https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826?sv=2018-03-28&sr=f&sig=ZshAYB8PCczY6GxQFF%2FGfoER2cAqMpo2ice2ka4k14Q%3D&se=2022-03-20T08%3A29%3A24Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240?sv=2018-03-28&sr=f&sig=BbBA%2BLMN1cx5%2BVDCSWmki%2BDwCvhY3bVYVXQvDcZalgg%3D&se=2022-05-20T08%3A30%3A19Z&sp=w response: body: string: '' @@ -1937,27 +2283,27 @@ interactions: content-length: - '0' date: - - Sun, 20 Mar 2022 06:29:25 GMT + - Fri, 20 May 2022 06:30:20 GMT etag: - - '"0x8DA0A3ABB88B782"' + - '"0x8DA3A29C9E01FB8"' last-modified: - - Sun, 20 Mar 2022 06:27:39 GMT + - Fri, 20 May 2022 06:27:18 GMT server: - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 x-ms-file-attributes: - Archive x-ms-file-change-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-creation-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-id: - - '10376414487740678144' + - '11529267822626603008' x-ms-file-last-write-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-parent-id: - '13835128424026341376' x-ms-file-permission-key: - - 11807555321441796965*827594984623582187 + - 2538703833122030037*10059812236488386907 x-ms-request-server-encrypted: - 'true' x-ms-version: @@ -1973,9 +2319,9 @@ interactions: Content-Length: - '11' User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.9.5; Windows 10) + - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) x-ms-date: - - Sun, 20 Mar 2022 06:29:25 GMT + - Fri, 20 May 2022 06:30:20 GMT x-ms-range: - bytes=0-10 x-ms-version: @@ -1983,7 +2329,7 @@ interactions: x-ms-write: - update method: PUT - uri: https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826?comp=range&sv=2018-03-28&sr=f&sig=ZshAYB8PCczY6GxQFF%2FGfoER2cAqMpo2ice2ka4k14Q%3D&se=2022-03-20T08%3A29%3A24Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240?comp=range&sv=2018-03-28&sr=f&sig=BbBA%2BLMN1cx5%2BVDCSWmki%2BDwCvhY3bVYVXQvDcZalgg%3D&se=2022-05-20T08%3A30%3A19Z&sp=w response: body: string: '' @@ -1993,11 +2339,11 @@ interactions: content-md5: - 99EB7GGDEcq+ZSyODG3erA== date: - - Sun, 20 Mar 2022 06:29:25 GMT + - Fri, 20 May 2022 06:30:20 GMT etag: - - '"0x8DA0A3AFA8E75B6"' + - '"0x8DA3A2A36DC329D"' last-modified: - - Sun, 20 Mar 2022 06:29:25 GMT + - Fri, 20 May 2022 06:30:20 GMT server: - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-server-encrypted: @@ -2009,7 +2355,7 @@ interactions: message: Created - request: body: '{"properties": {"source": {"type": "NetCoreZip", "version": "v2", "relativePath": - "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826", + "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240", "netCoreMainEntryPath": "test", "runtimeVersion": "NetCore_31"}, "deploymentSettings": {}}, "sku": {"name": "S0", "tier": "Standard"}}' headers: @@ -2028,27 +2374,27 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:29:25.6057138Z"}}' + string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"},"terminationGracePeriodSeconds":0},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:30:22.3485309Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100?api-version=2022-05-01-preview cache-control: - no-cache content-length: - - '988' + - '1004' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:26 GMT + - Fri, 20 May 2022 06:30:23 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/abb0ac34-8bb7-4c3b-8e04-483849b5a100/Spring/default?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -2060,9 +2406,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1198' + - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -2080,21 +2426,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","name":"b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","status":"Running","startTime":"2022-03-20T06:29:26.7028124Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100","name":"abb0ac34-8bb7-4c3b-8e04-483849b5a100","status":"Running","startTime":"2022-05-20T06:30:23.5444448Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:29:57 GMT + - Fri, 20 May 2022 06:30:53 GMT expires: - '-1' pragma: @@ -2112,7 +2458,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2130,21 +2476,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","name":"b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","status":"Running","startTime":"2022-03-20T06:29:26.7028124Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100","name":"abb0ac34-8bb7-4c3b-8e04-483849b5a100","status":"Running","startTime":"2022-05-20T06:30:23.5444448Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:30:07 GMT + - Fri, 20 May 2022 06:31:04 GMT expires: - '-1' pragma: @@ -2162,7 +2508,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2180,21 +2526,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","name":"b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","status":"Running","startTime":"2022-03-20T06:29:26.7028124Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100","name":"abb0ac34-8bb7-4c3b-8e04-483849b5a100","status":"Running","startTime":"2022-05-20T06:30:23.5444448Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:30:18 GMT + - Fri, 20 May 2022 06:31:14 GMT expires: - '-1' pragma: @@ -2212,7 +2558,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2230,23 +2576,23 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --runtime-version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","name":"b6a3f3ed-6d78-4b1b-b72b-cbe42346d8a4","status":"Failed","startTime":"2022-03-20T06:29:26.7028124Z","endTime":"2022-03-20T06:30:20.2734322Z","error":{"code":"BadRequest","message":"112404: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/abb0ac34-8bb7-4c3b-8e04-483849b5a100","name":"abb0ac34-8bb7-4c3b-8e04-483849b5a100","status":"Failed","startTime":"2022-05-20T06:30:23.5444448Z","endTime":"2022-05-20T06:31:24.5154769Z","error":{"code":"BadRequest","message":"112404: Failed to wait for deployment instances to be ready. Please check the application - log (see https://aka.ms/azure-spring-doc-log ), and try again later."}}' + log (see https://aka.ms/azure-spring-cloud-doc-log ), and try again later."}}' headers: cache-control: - no-cache content-length: - - '573' + - '555' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:30:28 GMT + - Fri, 20 May 2022 06:31:25 GMT expires: - '-1' pragma: @@ -2264,7 +2610,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2282,22 +2628,22 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-7b9797486f-q4jsj","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:29:38Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:29:25.6057138Z"}}' + string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-f958c7d9f-fcvvb","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:30:42Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:30:22.3485309Z"}}' headers: cache-control: - no-cache content-length: - - '1172' + - '1161' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:30:32 GMT + - Fri, 20 May 2022 06:31:29 GMT expires: - '-1' pragma: @@ -2317,7 +2663,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2335,22 +2681,22 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-7b9797486f-q4jsj","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:29:38Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:29:25.6057138Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-f958c7d9f-fcvvb","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:30:42Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:30:22.3485309Z"}}]}' headers: cache-control: - no-cache content-length: - - '1184' + - '1173' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:30:36 GMT + - Fri, 20 May 2022 06:31:33 GMT expires: - '-1' pragma: @@ -2368,9 +2714,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11995' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2392,27 +2738,27 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:30:37.7345786Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:31:34.8748934Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/a0b76741-680f-4aea-a2f9-d77cd66272f3?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/c6f99e5a-dacb-4e40-93fb-82fc02ad23c9?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '846' + - '806' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:30:38 GMT + - Fri, 20 May 2022 06:31:36 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/a0b76741-680f-4aea-a2f9-d77cd66272f3/Spring/deploy?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/c6f99e5a-dacb-4e40-93fb-82fc02ad23c9/Spring/deploy?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -2426,13 +2772,13 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted - request: body: '{"properties": {"source": {"type": "NetCoreZip", "version": "v2", "relativePath": - "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826", + "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240", "netCoreMainEntryPath": "test1", "runtimeVersion": "NetCore_31"}, "deploymentSettings": {}}, "sku": {"name": "S0", "tier": "Standard"}}' headers: @@ -2451,27 +2797,27 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:30:38.6720906Z"}}' + string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:31:36.6092816Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '989' + - '971' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:30:39 GMT + - Fri, 20 May 2022 06:31:37 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/63e739d0-768f-4b9c-a723-c9d806f8a71c/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/2c0e1a1f-477a-471a-b82e-d7c284a793f8/Spring/default?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -2483,9 +2829,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '1199' + - '1198' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -2503,21 +2849,21 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/a0b76741-680f-4aea-a2f9-d77cd66272f3?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/c6f99e5a-dacb-4e40-93fb-82fc02ad23c9?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/deploy/operationId/a0b76741-680f-4aea-a2f9-d77cd66272f3","name":"a0b76741-680f-4aea-a2f9-d77cd66272f3","status":"Succeeded","startTime":"2022-03-20T06:30:38.2834361Z","endTime":"2022-03-20T06:30:44.4290525Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/deploy/operationId/c6f99e5a-dacb-4e40-93fb-82fc02ad23c9","name":"c6f99e5a-dacb-4e40-93fb-82fc02ad23c9","status":"Succeeded","startTime":"2022-05-20T06:31:36.2489695Z","endTime":"2022-05-20T06:31:43.3117487Z"}' headers: cache-control: - no-cache content-length: - - '368' + - '350' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:08 GMT + - Fri, 20 May 2022 06:32:06 GMT expires: - '-1' pragma: @@ -2535,7 +2881,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2553,21 +2899,21 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:30:37.7345786Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:31:34.8748934Z"}}' headers: cache-control: - no-cache content-length: - - '847' + - '807' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:09 GMT + - Fri, 20 May 2022 06:32:07 GMT expires: - '-1' pragma: @@ -2587,7 +2933,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2605,21 +2951,21 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c","name":"63e739d0-768f-4b9c-a723-c9d806f8a71c","status":"Running","startTime":"2022-03-20T06:30:39.5235906Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8","name":"2c0e1a1f-477a-471a-b82e-d7c284a793f8","status":"Running","startTime":"2022-05-20T06:31:37.617803Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '307' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:09 GMT + - Fri, 20 May 2022 06:32:08 GMT expires: - '-1' pragma: @@ -2637,7 +2983,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2655,21 +3001,21 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c","name":"63e739d0-768f-4b9c-a723-c9d806f8a71c","status":"Running","startTime":"2022-03-20T06:30:39.5235906Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8","name":"2c0e1a1f-477a-471a-b82e-d7c284a793f8","status":"Running","startTime":"2022-05-20T06:31:37.617803Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '307' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:19 GMT + - Fri, 20 May 2022 06:32:18 GMT expires: - '-1' pragma: @@ -2687,7 +3033,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2705,21 +3051,21 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c","name":"63e739d0-768f-4b9c-a723-c9d806f8a71c","status":"Running","startTime":"2022-03-20T06:30:39.5235906Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8","name":"2c0e1a1f-477a-471a-b82e-d7c284a793f8","status":"Running","startTime":"2022-05-20T06:31:37.617803Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '307' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:30 GMT + - Fri, 20 May 2022 06:32:30 GMT expires: - '-1' pragma: @@ -2737,7 +3083,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2755,23 +3101,73 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/63e739d0-768f-4b9c-a723-c9d806f8a71c","name":"63e739d0-768f-4b9c-a723-c9d806f8a71c","status":"Failed","startTime":"2022-03-20T06:30:39.5235906Z","endTime":"2022-03-20T06:31:35.7876655Z","error":{"code":"BadRequest","message":"112404: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8","name":"2c0e1a1f-477a-471a-b82e-d7c284a793f8","status":"Running","startTime":"2022-05-20T06:31:37.617803Z"}' + headers: + cache-control: + - no-cache + content-length: + - '307' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:32:40 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app update + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --main-entry + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8?api-version=2022-03-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/2c0e1a1f-477a-471a-b82e-d7c284a793f8","name":"2c0e1a1f-477a-471a-b82e-d7c284a793f8","status":"Failed","startTime":"2022-05-20T06:31:37.617803Z","endTime":"2022-05-20T06:32:42.8383662Z","error":{"code":"BadRequest","message":"112404: Failed to wait for deployment instances to be ready. Please check the application - log (see https://aka.ms/azure-spring-doc-log ), and try again later."}}' + log (see https://aka.ms/azure-spring-cloud-doc-log ), and try again later."}}' headers: cache-control: - no-cache content-length: - - '573' + - '554' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:40 GMT + - Fri, 20 May 2022 06:32:51 GMT expires: - '-1' pragma: @@ -2789,7 +3185,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2807,21 +3203,21 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"southeastasia","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:14.6362979Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:30:37.7345786Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy","name":"deploy","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:25:31.3298235Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:31:34.8748934Z"}}' headers: cache-control: - no-cache content-length: - - '847' + - '807' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:44 GMT + - Fri, 20 May 2022 06:32:53 GMT expires: - '-1' pragma: @@ -2839,9 +3235,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' + - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2859,22 +3255,22 @@ interactions: ParameterSetName: - -n -g -s --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-5dcc549cfc-jfggx","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:30:51Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:30:38.6720906Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-5cf985994d-jcgxb","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:32:02Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:31:36.6092816Z"}}]}' headers: cache-control: - no-cache content-length: - - '1185' + - '1175' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:47 GMT + - Fri, 20 May 2022 06:32:56 GMT expires: - '-1' pragma: @@ -2894,7 +3290,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2912,22 +3308,22 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-5dcc549cfc-jfggx","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:30:51Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:30:38.6720906Z"}}' + string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-5cf985994d-jcgxb","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:32:02Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:31:36.6092816Z"}}' headers: cache-control: - no-cache content-length: - - '1173' + - '1163' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:50 GMT + - Fri, 20 May 2022 06:33:00 GMT expires: - '-1' pragma: @@ -2947,7 +3343,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -2965,22 +3361,22 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments?api-version=2022-01-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-298e782d-bec3-400a-8023-b0a1b8871826","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-5dcc549cfc-jfggx","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:30:51Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:30:38.6720906Z"}}]}' + string: '{"value":[{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-d91a498c-0eeb-4f6a-9136-fcc95828e240","version":"v2","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test1"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-5cf985994d-jcgxb","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:32:02Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:31:36.6092816Z"}}]}' headers: cache-control: - no-cache content-length: - - '1185' + - '1175' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:54 GMT + - Fri, 20 May 2022 06:33:04 GMT expires: - '-1' pragma: @@ -3000,7 +3396,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -3020,21 +3416,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-05-01-preview response: body: - string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773","uploadUrl":"https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773?sv=2018-03-28&sr=f&sig=9Z2Fz59gmKPgpfrxwbE3y9b5MvSQh4VbJWTZD6uMPy0%3D&se=2022-03-20T08%3A31%3A56Z&sp=w"}' + string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-98acc768-d261-47e9-a272-290c33dc71e5","uploadUrl":"https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-98acc768-d261-47e9-a272-290c33dc71e5?sv=2018-03-28&sr=f&sig=JEyu4WyHzynRA7GFrACiD5mI%2BUJ8IbLhAgJJOQuwqKI%3D&se=2022-05-20T08%3A33%3A06Z&sp=w"}' headers: cache-control: - no-cache content-length: - - '469' + - '471' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:56 GMT + - Fri, 20 May 2022 06:33:06 GMT expires: - '-1' pragma: @@ -3054,7 +3450,7 @@ interactions: x-ms-ratelimit-remaining-subscription-writes: - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -3066,17 +3462,17 @@ interactions: Content-Length: - '0' User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.9.5; Windows 10) + - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) x-ms-content-length: - '11' x-ms-date: - - Sun, 20 Mar 2022 06:31:57 GMT + - Fri, 20 May 2022 06:33:07 GMT x-ms-file-attributes: - Archive x-ms-file-creation-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-last-write-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-permission: - Inherit x-ms-type: @@ -3084,7 +3480,7 @@ interactions: x-ms-version: - '2019-02-02' method: PUT - uri: https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773?sv=2018-03-28&sr=f&sig=9Z2Fz59gmKPgpfrxwbE3y9b5MvSQh4VbJWTZD6uMPy0%3D&se=2022-03-20T08%3A31%3A56Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-98acc768-d261-47e9-a272-290c33dc71e5?sv=2018-03-28&sr=f&sig=JEyu4WyHzynRA7GFrACiD5mI%2BUJ8IbLhAgJJOQuwqKI%3D&se=2022-05-20T08%3A33%3A06Z&sp=w response: body: string: '' @@ -3092,27 +3488,27 @@ interactions: content-length: - '0' date: - - Sun, 20 Mar 2022 06:31:57 GMT + - Fri, 20 May 2022 06:33:08 GMT etag: - - '"0x8DA0A3ABB88B782"' + - '"0x8DA3A29C9E01FB8"' last-modified: - - Sun, 20 Mar 2022 06:27:39 GMT + - Fri, 20 May 2022 06:27:18 GMT server: - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 x-ms-file-attributes: - Archive x-ms-file-change-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-creation-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-id: - - '11529283215789391872' + - '11529223842161491968' x-ms-file-last-write-time: - - '2022-03-20T06:27:39.7026690Z' + - '2022-05-20T06:27:18.1325240Z' x-ms-file-parent-id: - '13835128424026341376' x-ms-file-permission-key: - - 11807555321441796965*827594984623582187 + - 2538703833122030037*10059812236488386907 x-ms-request-server-encrypted: - 'true' x-ms-version: @@ -3128,9 +3524,9 @@ interactions: Content-Length: - '11' User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.9.5; Windows 10) + - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) x-ms-date: - - Sun, 20 Mar 2022 06:31:57 GMT + - Fri, 20 May 2022 06:33:08 GMT x-ms-range: - bytes=0-10 x-ms-version: @@ -3138,7 +3534,7 @@ interactions: x-ms-write: - update method: PUT - uri: https://4a4e9b0154c045f98b03e094.file.core.windows.net/0c7bf6b91ae840c78655bb6f57ea0391/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773?comp=range&sv=2018-03-28&sr=f&sig=9Z2Fz59gmKPgpfrxwbE3y9b5MvSQh4VbJWTZD6uMPy0%3D&se=2022-03-20T08%3A31%3A56Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-98acc768-d261-47e9-a272-290c33dc71e5?comp=range&sv=2018-03-28&sr=f&sig=JEyu4WyHzynRA7GFrACiD5mI%2BUJ8IbLhAgJJOQuwqKI%3D&se=2022-05-20T08%3A33%3A06Z&sp=w response: body: string: '' @@ -3148,11 +3544,11 @@ interactions: content-md5: - 99EB7GGDEcq+ZSyODG3erA== date: - - Sun, 20 Mar 2022 06:31:57 GMT + - Fri, 20 May 2022 06:33:08 GMT etag: - - '"0x8DA0A3B55551B95"' + - '"0x8DA3A2A9AE14CBE"' last-modified: - - Sun, 20 Mar 2022 06:31:57 GMT + - Fri, 20 May 2022 06:33:08 GMT server: - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-server-encrypted: @@ -3164,7 +3560,7 @@ interactions: message: Created - request: body: '{"properties": {"source": {"type": "NetCoreZip", "version": "v3", "relativePath": - "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773", + "resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-98acc768-d261-47e9-a272-290c33dc71e5", "netCoreMainEntryPath": "test3", "runtimeVersion": "NetCore_31"}, "deploymentSettings": {}}, "sku": {"name": "S0", "tier": "Standard"}}' headers: @@ -3183,27 +3579,27 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773","version":"v3","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test3"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:31:58.6234345Z"}}' + string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-98acc768-d261-47e9-a272-290c33dc71e5","version":"v3","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test3"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"},"terminationGracePeriodSeconds":0},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:33:09.0558161Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0018ea55-914e-46d7-a31a-a669c7f535e1?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5?api-version=2022-05-01-preview cache-control: - no-cache content-length: - - '989' + - '1005' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:31:59 GMT + - Fri, 20 May 2022 06:33:09 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/0018ea55-914e-46d7-a31a-a669c7f535e1/Spring/default?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/798a9e23-ef1c-4730-96fa-8da885a8dfc5/Spring/default?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -3217,7 +3613,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -3235,21 +3631,71 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5?api-version=2022-05-01-preview + response: + body: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5","name":"798a9e23-ef1c-4730-96fa-8da885a8dfc5","status":"Running","startTime":"2022-05-20T06:33:10.2591594Z"}' + headers: + cache-control: + - no-cache + content-length: + - '308' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 20 May 2022 06:33:40 GMT + expires: + - '-1' + pragma: + - no-cache + request-context: + - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d + server: + - nginx/1.17.7 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding,Accept-Encoding + x-content-type-options: + - nosniff + x-rp-server-mvid: + - 5e115b18-fadf-4457-94d9-ae330a47aa6b + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - spring app deploy + Connection: + - keep-alive + ParameterSetName: + - -n -g -s --artifact-path --version --main-entry + User-Agent: + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0018ea55-914e-46d7-a31a-a669c7f535e1?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0018ea55-914e-46d7-a31a-a669c7f535e1","name":"0018ea55-914e-46d7-a31a-a669c7f535e1","status":"Running","startTime":"2022-03-20T06:31:59.7546086Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5","name":"798a9e23-ef1c-4730-96fa-8da885a8dfc5","status":"Running","startTime":"2022-05-20T06:33:10.2591594Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:32:30 GMT + - Fri, 20 May 2022 06:33:51 GMT expires: - '-1' pragma: @@ -3267,7 +3713,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -3285,21 +3731,21 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0018ea55-914e-46d7-a31a-a669c7f535e1?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0018ea55-914e-46d7-a31a-a669c7f535e1","name":"0018ea55-914e-46d7-a31a-a669c7f535e1","status":"Running","startTime":"2022-03-20T06:31:59.7546086Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5","name":"798a9e23-ef1c-4730-96fa-8da885a8dfc5","status":"Running","startTime":"2022-05-20T06:33:10.2591594Z"}' headers: cache-control: - no-cache content-length: - - '326' + - '308' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:32:40 GMT + - Fri, 20 May 2022 06:34:01 GMT expires: - '-1' pragma: @@ -3317,7 +3763,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -3335,23 +3781,23 @@ interactions: ParameterSetName: - -n -g -s --artifact-path --version --main-entry User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0018ea55-914e-46d7-a31a-a669c7f535e1?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/default/operationId/0018ea55-914e-46d7-a31a-a669c7f535e1","name":"0018ea55-914e-46d7-a31a-a669c7f535e1","status":"Failed","startTime":"2022-03-20T06:31:59.7546086Z","endTime":"2022-03-20T06:32:45.3008272Z","error":{"code":"BadRequest","message":"112404: + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/798a9e23-ef1c-4730-96fa-8da885a8dfc5","name":"798a9e23-ef1c-4730-96fa-8da885a8dfc5","status":"Failed","startTime":"2022-05-20T06:33:10.2591594Z","endTime":"2022-05-20T06:34:12.2229771Z","error":{"code":"BadRequest","message":"112404: Failed to wait for deployment instances to be ready. Please check the application - log (see https://aka.ms/azure-spring-doc-log ), and try again later."}}' + log (see https://aka.ms/azure-spring-cloud-doc-log ), and try again later."}}' headers: cache-control: - no-cache content-length: - - '573' + - '555' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:32:52 GMT + - Fri, 20 May 2022 06:34:12 GMT expires: - '-1' pragma: @@ -3369,7 +3815,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -3387,22 +3833,22 @@ interactions: ParameterSetName: - -n --app -g -s User-Agent: - - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/mock-deployment?api-version=2022-01-01-preview response: body: - string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022032006-a109b68c-a27a-4f9c-ba10-eb41cfd61773","version":"v3","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test3"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-d4987fd5b-tz6kv","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-03-20T06:32:07Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T06:26:50.7614162Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T06:31:58.6234345Z"}}' + string: '{"properties":{"source":{"type":"NetCoreZip","relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-98acc768-d261-47e9-a272-290c33dc71e5","version":"v3","runtimeVersion":"NetCore_31","netCoreMainEntryPath":"test3"},"deploymentSettings":{"resourceRequests":{"cpu":"2","memory":"1Gi"},"environmentVariables":{"bas":"baz"}},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"deploy-default-6-6488f77574-dkvmh","status":"Failed","reason":"Fail + to start, check the console log for this instance","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T06:33:22Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T06:26:07.4392301Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T06:33:09.0558161Z"}}' headers: cache-control: - no-cache content-length: - - '1172' + - '1163' content-type: - application/json; charset=utf-8 date: - - Sun, 20 Mar 2022 06:32:55 GMT + - Fri, 20 May 2022 06:34:17 GMT expires: - '-1' pragma: @@ -3420,9 +3866,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - bbaae9d6-85b5-4e2b-afd6-9d79cbd321cc + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK From c1652a71737b049c383a53015155745822c41dc7 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 15:23:50 +0800 Subject: [PATCH 17/21] fix test --- .../tests/latest/recordings/test_app_crud_1.yaml | 14 +++++++------- .../tests/latest/recordings/test_deploy_app.yaml | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml index 1eb014c4e01..eebc854f58f 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_crud_1.yaml @@ -701,7 +701,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-05-01-preview response: body: string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"0c7bf6b91ae840c78655bb6f57ea0391","networkProfile":{"outboundIPs":{"publicIPs":["20.24.160.30","20.24.160.222"]}},"powerState":"Running","fqdn":"cli-unittest.asc-test.net"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"southeastasia","tags":{"asc-test":"prod","api-target":"arm","service-create-time":"2022-03-20 @@ -761,13 +761,13 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app-1/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app-1/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":{}},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app-1/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T07:14:43.6867805Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T07:14:43.6867805Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384?api-version=2022-05-01-preview cache-control: - no-cache content-length: @@ -779,7 +779,7 @@ interactions: expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/23488d90-fbb0-456a-98cf-cde23f27f384/Spring/green?api-version=2022-03-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationResults/23488d90-fbb0-456a-98cf-cde23f27f384/Spring/green?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -813,7 +813,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384?api-version=2022-05-01-preview response: body: string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384","name":"23488d90-fbb0-456a-98cf-cde23f27f384","status":"Running","startTime":"2022-03-20T07:14:45.1162374Z"}' @@ -863,7 +863,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384?api-version=2022-05-01-preview response: body: string: '{"id":"subscriptions/6c933f90-8115-4392-90f2-7077c9fa5dbd/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/southeastasia/operationStatus/green/operationId/23488d90-fbb0-456a-98cf-cde23f27f384","name":"23488d90-fbb0-456a-98cf-cde23f27f384","status":"Succeeded","startTime":"2022-03-20T07:14:45.1162374Z","endTime":"2022-03-20T07:15:18.6276151Z"}' @@ -913,7 +913,7 @@ interactions: User-Agent: - AZURECLI/2.34.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.9.5 (Windows-10-10.0.22000-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app-1/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app-1/deployments/mock-deployment?api-version=2022-05-01-preview response: body: string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":{}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-crud-app-1-green-21-77fc8bbdf7-v9pwt","status":"Running","discoveryStatus":"OUT_OF_SERVICE","startTime":"2022-03-20T07:14:55Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-crud-app-1/deployments/green","name":"green","systemData":{"createdBy":"jiec@microsoft.com","createdByType":"User","createdAt":"2022-03-20T07:14:43.6867805Z","lastModifiedBy":"jiec@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-03-20T07:14:43.6867805Z"}}' diff --git a/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml b/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml index eb1810947e6..61e59389ceb 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_deploy_app.yaml @@ -907,7 +907,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/deploy/getResourceUploadUrl?api-version=2022-05-01-preview response: body: - string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","uploadUrl":"https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?sv=2018-03-28&sr=f&sig=83T6craO99vLH46Td8kAJLnfMTEXy9Hcl%2FTF0pe%2Bvyk%3D&se=2022-05-20T08%3A27%3A17Z&sp=w"}' + string: '{"relativePath":"resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad","uploadUrl":"https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?sv=2018-03-28x"}' headers: cache-control: - no-cache @@ -966,7 +966,7 @@ interactions: x-ms-version: - '2019-02-02' method: PUT - uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?sv=2018-03-28&sr=f&sig=83T6craO99vLH46Td8kAJLnfMTEXy9Hcl%2FTF0pe%2Bvyk%3D&se=2022-05-20T08%3A27%3A17Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?sv=2018-03-28x response: body: string: '' @@ -1020,7 +1020,7 @@ interactions: x-ms-write: - update method: PUT - uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?comp=range&sv=2018-03-28&sr=f&sig=83T6craO99vLH46Td8kAJLnfMTEXy9Hcl%2FTF0pe%2Bvyk%3D&se=2022-05-20T08%3A27%3A17Z&sp=w + uri: https://2235cf691ab84ed08a70cf6a.file.core.windows.net/e0c9ac05b1964af6878f51c774361a54/resources/b7bd55c11b781b0ccc43aa6e57f9dadf0660e9d1d4e27e0979ee43a407d454ae-2022052006-3b33c689-ca81-4d39-9c80-12e9b79e37ad?comp=range&sv=2018-03-28x response: body: string: '' From a03de21dce2365698a244c1450611cda634b57ed Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 17:10:29 +0800 Subject: [PATCH 18/21] fix test --- .../recordings/test_app_deploy_container.yaml | 1338 +++-------------- .../tests/latest/test_asa_scenario.py | 11 +- 2 files changed, 172 insertions(+), 1177 deletions(-) diff --git a/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml b/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml index 0b07d114ae8..84ecb62f3b5 100644 --- a/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml +++ b/src/spring/azext_spring/tests/latest/recordings/test_app_deploy_container.yaml @@ -13,57 +13,7 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview - response: - body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' - headers: - cache-control: - - no-cache - content-length: - - '771' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:10:15 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - vary: - - Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app create - Connection: - - keep-alive - ParameterSetName: - - -s -g -n - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container?api-version=2022-03-01-preview response: @@ -77,7 +27,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:10:16 GMT + - Fri, 20 May 2022 08:56:15 GMT expires: - '-1' pragma: @@ -91,9 +41,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11998' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 404 message: Not Found @@ -111,21 +61,21 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' + string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":2,"serviceId":"e0c9ac05b1964af6878f51c774361a54","networkProfile":{"outboundIPs":{"publicIPs":["20.237.73.139","20.237.73.181"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T04:22:48.680302Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T04:30:25.8146564Z"}}' headers: cache-control: - no-cache content-length: - - '771' + - '770' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:10:17 GMT + - Fri, 20 May 2022 08:56:16 GMT expires: - '-1' pragma: @@ -145,7 +95,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -168,15 +118,15 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:18.9016189Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:18.9016189Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Creating","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:17.6583556Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:17.6583556Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/0565679b-726a-43dd-af00-f46c1f068eb2?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/ce18298a-0f3d-4ff9-8f6e-a833a31a6210?api-version=2022-03-01-preview cache-control: - no-cache content-length: @@ -184,11 +134,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:10:18 GMT + - Fri, 20 May 2022 08:56:18 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/0565679b-726a-43dd-af00-f46c1f068eb2/Spring/test-container?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/ce18298a-0f3d-4ff9-8f6e-a833a31a6210/Spring/test-container?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -202,7 +152,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -220,21 +170,21 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/0565679b-726a-43dd-af00-f46c1f068eb2?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/ce18298a-0f3d-4ff9-8f6e-a833a31a6210?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/0565679b-726a-43dd-af00-f46c1f068eb2","name":"0565679b-726a-43dd-af00-f46c1f068eb2","status":"Succeeded","startTime":"2022-02-24T08:10:19.4444068Z","endTime":"2022-02-24T08:10:25.677718Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/ce18298a-0f3d-4ff9-8f6e-a833a31a6210","name":"ce18298a-0f3d-4ff9-8f6e-a833a31a6210","status":"Succeeded","startTime":"2022-05-20T08:56:19.0472538Z","endTime":"2022-05-20T08:56:26.3435312Z"}' headers: cache-control: - no-cache content-length: - - '357' + - '358' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:10:49 GMT + - Fri, 20 May 2022 08:56:49 GMT expires: - '-1' pragma: @@ -252,7 +202,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -270,12 +220,12 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:18.9016189Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:18.9016189Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:17.6583556Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:17.6583556Z"}}' headers: cache-control: - no-cache @@ -284,7 +234,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:10:50 GMT + - Fri, 20 May 2022 08:56:50 GMT expires: - '-1' pragma: @@ -302,9 +252,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' + - '11997' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -329,27 +279,27 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:54.596018Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:54.596018Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb?api-version=2022-03-01-preview cache-control: - no-cache content-length: - - '800' + - '798' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:10:56 GMT + - Fri, 20 May 2022 08:56:55 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/24b10b8d-44c6-4c76-8660-d95dcec16792/Spring/default?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb/Spring/default?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -363,7 +313,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 201 message: Created @@ -386,15 +336,15 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PATCH uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:18.9016189Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:56.8067785Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Updating","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:17.6583556Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:56.0647726Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/c133f3a5-43a8-4c28-af1e-6f292cb4aa68?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/42814bec-8cc3-4a0a-a4cf-ccb08183e86e?api-version=2022-03-01-preview cache-control: - no-cache content-length: @@ -402,11 +352,11 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:10:57 GMT + - Fri, 20 May 2022 08:56:56 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/c133f3a5-43a8-4c28-af1e-6f292cb4aa68/Spring/test-container?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/42814bec-8cc3-4a0a-a4cf-ccb08183e86e/Spring/test-container?api-version=2022-03-01-preview pragma: - no-cache request-context: @@ -420,7 +370,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1198' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -438,12 +388,12 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792","name":"24b10b8d-44c6-4c76-8660-d95dcec16792","status":"Running","startTime":"2022-02-24T08:10:56.3941771Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","name":"78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","status":"Running","startTime":"2022-05-20T08:56:55.6974502Z"}' headers: cache-control: - no-cache @@ -452,7 +402,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:11:26 GMT + - Fri, 20 May 2022 08:57:25 GMT expires: - '-1' pragma: @@ -470,7 +420,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -488,21 +438,21 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/c133f3a5-43a8-4c28-af1e-6f292cb4aa68?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/42814bec-8cc3-4a0a-a4cf-ccb08183e86e?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/c133f3a5-43a8-4c28-af1e-6f292cb4aa68","name":"c133f3a5-43a8-4c28-af1e-6f292cb4aa68","status":"Succeeded","startTime":"2022-02-24T08:10:57.0267899Z","endTime":"2022-02-24T08:11:04.1094456Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/test-container/operationId/42814bec-8cc3-4a0a-a4cf-ccb08183e86e","name":"42814bec-8cc3-4a0a-a4cf-ccb08183e86e","status":"Succeeded","startTime":"2022-05-20T08:56:56.7510398Z","endTime":"2022-05-20T08:57:04.725261Z"}' headers: cache-control: - no-cache content-length: - - '358' + - '357' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:11:27 GMT + - Fri, 20 May 2022 08:57:26 GMT expires: - '-1' pragma: @@ -520,7 +470,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -538,12 +488,12 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:18.9016189Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:56.8067785Z"}}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:17.6583556Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:56.0647726Z"}}' headers: cache-control: - no-cache @@ -552,7 +502,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:11:27 GMT + - Fri, 20 May 2022 08:57:27 GMT expires: - '-1' pragma: @@ -570,9 +520,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11997' + - '11996' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -590,12 +540,12 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792","name":"24b10b8d-44c6-4c76-8660-d95dcec16792","status":"Running","startTime":"2022-02-24T08:10:56.3941771Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","name":"78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","status":"Running","startTime":"2022-05-20T08:56:55.6974502Z"}' headers: cache-control: - no-cache @@ -604,7 +554,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:11:37 GMT + - Fri, 20 May 2022 08:57:36 GMT expires: - '-1' pragma: @@ -622,7 +572,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -640,12 +590,12 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792","name":"24b10b8d-44c6-4c76-8660-d95dcec16792","status":"Running","startTime":"2022-02-24T08:10:56.3941771Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","name":"78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","status":"Running","startTime":"2022-05-20T08:56:55.6974502Z"}' headers: cache-control: - no-cache @@ -654,7 +604,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:11:47 GMT + - Fri, 20 May 2022 08:57:46 GMT expires: - '-1' pragma: @@ -672,7 +622,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -690,21 +640,21 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb?api-version=2022-03-01-preview response: body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/24b10b8d-44c6-4c76-8660-d95dcec16792","name":"24b10b8d-44c6-4c76-8660-d95dcec16792","status":"Succeeded","startTime":"2022-02-24T08:10:56.3941771Z","endTime":"2022-02-24T08:11:55.7587999Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","name":"78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","status":"Running","startTime":"2022-05-20T08:56:55.6974502Z"}' headers: cache-control: - no-cache content-length: - - '351' + - '308' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:11:58 GMT + - Fri, 20 May 2022 08:57:57 GMT expires: - '-1' pragma: @@ -722,7 +672,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -740,21 +690,21 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb?api-version=2022-03-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7d888965c7-q7b9q","status":"Running","discoveryStatus":"UP","startTime":"2022-02-24T08:11:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","name":"78951c46-8ce1-4a90-b6a8-75ed93c6cfeb","status":"Succeeded","startTime":"2022-05-20T08:56:55.6974502Z","endTime":"2022-05-20T08:58:07.3020542Z"}' headers: cache-control: - no-cache content-length: - - '929' + - '351' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:01 GMT + - Fri, 20 May 2022 08:58:07 GMT expires: - '-1' pragma: @@ -771,10 +721,8 @@ interactions: - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -782,7 +730,7 @@ interactions: body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate CommandName: @@ -792,21 +740,21 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview response: body: - string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:18.9016189Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:56.8067785Z"}}' + string: '{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7845cb7f76-h5fts","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T08:57:01Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:54.596018Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:54.596018Z"}}' headers: cache-control: - no-cache content-length: - - '823' + - '937' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:02 GMT + - Fri, 20 May 2022 08:58:12 GMT expires: - '-1' pragma: @@ -824,9 +772,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11996' + - '11999' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -844,73 +792,21 @@ interactions: ParameterSetName: - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-03-01-preview - response: - body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7d888965c7-q7b9q","status":"Running","discoveryStatus":"UP","startTime":"2022-02-24T08:11:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}]}' - headers: - cache-control: - - no-cache - content-length: - - '941' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:12:03 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11997' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --container-image - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7d888965c7-q7b9q","status":"Running","discoveryStatus":"UP","startTime":"2022-02-24T08:11:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}]}' + string: '{"properties":{"addonConfigs":{"applicationConfigurationService":{},"serviceRegistry":{}},"public":false,"provisioningState":"Succeeded","fqdn":"cli-unittest.azuremicroservices.io","httpsOnly":false,"temporaryDisk":{"sizeInGB":5,"mountPath":"/tmp"},"persistentDisk":{"sizeInGB":0,"mountPath":"/persistent"},"enableEndToEndTLS":false},"type":"Microsoft.AppPlatform/Spring/apps","identity":null,"location":"eastus","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container","name":"test-container","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:17.6583556Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:56.0647726Z"}}' headers: cache-control: - no-cache content-length: - - '941' + - '823' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:06 GMT + - Fri, 20 May 2022 08:58:18 GMT expires: - '-1' pragma: @@ -928,9 +824,9 @@ interactions: x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '11995' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -942,79 +838,27 @@ interactions: Accept-Encoding: - gzip, deflate CommandName: - - spring app deploy + - spring app create Connection: - keep-alive ParameterSetName: - - -g -s -n --container-image + - -s -g -n User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-03-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7d888965c7-q7b9q","status":"Running","discoveryStatus":"UP","startTime":"2022-02-24T08:11:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:10:55.1167761Z"}}]}' - headers: - cache-control: - - no-cache - content-length: - - '941' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:12:06 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --container-image - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview - response: - body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7845cb7f76-h5fts","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T08:57:01Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:54.596018Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:54.596018Z"}}]}' headers: cache-control: - no-cache content-length: - - '771' + - '949' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:09 GMT + - Fri, 20 May 2022 08:58:21 GMT expires: - '-1' pragma: @@ -1034,59 +878,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --container-image - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview - response: - body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' - headers: - cache-control: - - no-cache - content-length: - - '771' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:12:11 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1104,21 +896,21 @@ interactions: ParameterSetName: - -g -s -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-01-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' + string: '{"value":[{"properties":{"source":{"type":"Jar","relativePath":"","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7845cb7f76-h5fts","status":"Running","discoveryStatus":"UNREGISTERED","startTime":"2022-05-20T08:57:01Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:54.596018Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:56:54.596018Z"}}]}' headers: cache-control: - no-cache content-length: - - '771' + - '949' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:13 GMT + - Fri, 20 May 2022 08:58:24 GMT expires: - '-1' pragma: @@ -1138,7 +930,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1163,27 +955,27 @@ interactions: ParameterSetName: - -g -s -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}}' + string: '{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":90},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:54.596018Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:58:26.4936243Z"}}' headers: azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/d21028e1-2ec2-46a3-b2c0-ce37fa19525d?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/667ece02-e5d5-4456-b90d-785a6f24c188?api-version=2022-05-01-preview cache-control: - no-cache content-length: - - '873' + - '891' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:14 GMT + - Fri, 20 May 2022 08:58:29 GMT expires: - '-1' location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/d21028e1-2ec2-46a3-b2c0-ce37fa19525d/Spring/default?api-version=2022-01-01-preview + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/667ece02-e5d5-4456-b90d-785a6f24c188/Spring/default?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -1197,7 +989,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '1199' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 202 message: Accepted @@ -1215,12 +1007,12 @@ interactions: ParameterSetName: - -g -s -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/d21028e1-2ec2-46a3-b2c0-ce37fa19525d?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/667ece02-e5d5-4456-b90d-785a6f24c188?api-version=2022-05-01-preview response: body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/d21028e1-2ec2-46a3-b2c0-ce37fa19525d","name":"d21028e1-2ec2-46a3-b2c0-ce37fa19525d","status":"Succeeded","startTime":"2022-02-24T08:12:15.0437863Z","endTime":"2022-02-24T08:12:42.4637167Z"}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/667ece02-e5d5-4456-b90d-785a6f24c188","name":"667ece02-e5d5-4456-b90d-785a6f24c188","status":"Succeeded","startTime":"2022-05-20T08:58:29.6379585Z","endTime":"2022-05-20T08:58:58.9544286Z"}' headers: cache-control: - no-cache @@ -1229,7 +1021,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:45 GMT + - Fri, 20 May 2022 08:58:59 GMT expires: - '-1' pragma: @@ -1247,7 +1039,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1265,21 +1057,21 @@ interactions: ParameterSetName: - -g -s -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7b896dd978-s6rrj","status":"Running","discoveryStatus":"N/A","startTime":"2022-02-24T08:12:26Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}}' + string: '{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":90,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-5fcd55d45-xqnj7","status":"Running","discoveryStatus":"N/A","startTime":"2022-05-20T08:58:40Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:54.596018Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:58:26.4936243Z"}}' headers: cache-control: - no-cache content-length: - - '1003' + - '1391' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:49 GMT + - Fri, 20 May 2022 08:59:02 GMT expires: - '-1' pragma: @@ -1299,7 +1091,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1317,21 +1109,21 @@ interactions: ParameterSetName: - -g -s --app -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-05-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' + string: '{"value":[{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":90,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-5fcd55d45-xqnj7","status":"Running","discoveryStatus":"N/A","startTime":"2022-05-20T08:58:40Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:56:54.596018Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:58:26.4936243Z"}}]}' headers: cache-control: - no-cache content-length: - - '771' + - '1403' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:52 GMT + - Fri, 20 May 2022 08:59:07 GMT expires: - '-1' pragma: @@ -1351,12 +1143,15 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11999' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK - request: - body: null + body: '{"properties": {"source": {"type": "Container", "customContainer": {"server": + "docker.io", "containerImage": "springio/gs-spring-boot-docker"}}, "deploymentSettings": + {"resourceRequests": {"cpu": "1", "memory": "1Gi"}}}, "sku": {"name": "S0", + "tier": "Standard", "capacity": 1}}' headers: Accept: - application/json @@ -1366,26 +1161,34 @@ interactions: - spring app deployment create Connection: - keep-alive + Content-Length: + - '278' + Content-Type: + - application/json ParameterSetName: - -g -s --app -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' + string: '{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":0},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:59:09.8559209Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:59:09.8559209Z"}}' headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/bfe8dd6e-3c1a-46c6-a206-b48bf32027ec?api-version=2022-05-01-preview cache-control: - no-cache content-length: - - '771' + - '875' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:54 GMT + - Fri, 20 May 2022 08:59:10 GMT expires: - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/bfe8dd6e-3c1a-46c6-a206-b48bf32027ec/Spring/green?api-version=2022-05-01-preview pragma: - no-cache request-context: @@ -1394,24 +1197,20 @@ interactions: - nginx/1.17.7 strict-transport-security: - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' + - '1199' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: - code: 200 - message: OK + code: 201 + message: Created - request: body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate CommandName: @@ -1421,21 +1220,21 @@ interactions: ParameterSetName: - -g -s --app -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/bfe8dd6e-3c1a-46c6-a206-b48bf32027ec?api-version=2022-05-01-preview response: body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/bfe8dd6e-3c1a-46c6-a206-b48bf32027ec","name":"bfe8dd6e-3c1a-46c6-a206-b48bf32027ec","status":"Running","startTime":"2022-05-20T08:59:10.8257136Z"}' headers: cache-control: - no-cache content-length: - - '771' + - '306' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:55 GMT + - Fri, 20 May 2022 08:59:40 GMT expires: - '-1' pragma: @@ -1452,10 +1251,8 @@ interactions: - Accept-Encoding,Accept-Encoding x-content-type-options: - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1463,7 +1260,7 @@ interactions: body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate CommandName: @@ -1473,184 +1270,21 @@ interactions: ParameterSetName: - -g -s --app -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-01-01-preview + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/bfe8dd6e-3c1a-46c6-a206-b48bf32027ec?api-version=2022-05-01-preview response: body: - string: '{"value":[{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7b896dd978-s6rrj","status":"Running","discoveryStatus":"N/A","startTime":"2022-02-24T08:12:26Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}}]}' + string: '{"id":"subscriptions/799c12ba-353c-44a1-883d-84808ebb2216/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/bfe8dd6e-3c1a-46c6-a206-b48bf32027ec","name":"bfe8dd6e-3c1a-46c6-a206-b48bf32027ec","status":"Succeeded","startTime":"2022-05-20T08:59:10.8257136Z","endTime":"2022-05-20T08:59:42.720343Z"}' headers: cache-control: - no-cache content-length: - - '1015' + - '348' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:12:58 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deployment create - Connection: - - keep-alive - ParameterSetName: - - -g -s --app -n --container-image - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-03-01-preview - response: - body: - string: '{"value":[{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7b896dd978-s6rrj","status":"Running","discoveryStatus":"N/A","startTime":"2022-02-24T08:12:26Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}}]}' - headers: - cache-control: - - no-cache - content-length: - - '1015' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:12:58 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: '{"properties": {"source": {"type": "Container", "customContainer": {"server": - "docker.io", "containerImage": "springio/gs-spring-boot-docker"}}, "deploymentSettings": - {"resourceRequests": {"cpu": "1", "memory": "1Gi"}}}, "sku": {"name": "S0", - "tier": "Standard", "capacity": 1}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deployment create - Connection: - - keep-alive - Content-Length: - - '278' - Content-Type: - - application/json - ParameterSetName: - - -g -s --app -n --container-image - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview - response: - body: - string: '{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Creating","status":"Running","active":false,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:12:58.9051731Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:58.9051731Z"}}' - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/5a94a974-8802-4f70-ba20-e19f293d307e?api-version=2022-01-01-preview - cache-control: - - no-cache - content-length: - - '841' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:12:59 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/5a94a974-8802-4f70-ba20-e19f293d307e/Spring/green?api-version=2022-01-01-preview - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '1199' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deployment create - Connection: - - keep-alive - ParameterSetName: - - -g -s --app -n --container-image - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/5a94a974-8802-4f70-ba20-e19f293d307e?api-version=2022-01-01-preview - response: - body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/green/operationId/5a94a974-8802-4f70-ba20-e19f293d307e","name":"5a94a974-8802-4f70-ba20-e19f293d307e","status":"Succeeded","startTime":"2022-02-24T08:12:59.3776935Z","endTime":"2022-02-24T08:13:17.3600948Z"}' - headers: - cache-control: - - no-cache - content-length: - - '349' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:29 GMT + - Fri, 20 May 2022 08:59:52 GMT expires: - '-1' pragma: @@ -1668,7 +1302,7 @@ interactions: x-content-type-options: - nosniff x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK @@ -1686,651 +1320,21 @@ interactions: ParameterSetName: - -g -s --app -n --container-image User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-03-01-preview - response: - body: - string: '{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-container-green-14-648cbc5b87-sj5zw","status":"Running","discoveryStatus":"N/A","startTime":"2022-02-24T08:13:01Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:12:58.9051731Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:58.9051731Z"}}' - headers: - cache-control: - - no-cache - content-length: - - '969' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:32 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments?api-version=2022-03-01-preview - response: - body: - string: '{"value":[{"properties":{"source":{"type":"Container","version":"","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"jvmOptions":"","environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7b896dd978-s6rrj","status":"Running","discoveryStatus":"N/A","startTime":"2022-02-24T08:12:26Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:13.9598533Z"}},{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-container-green-14-648cbc5b87-sj5zw","status":"Running","discoveryStatus":"N/A","startTime":"2022-02-24T08:13:01Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:12:58.9051731Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:12:58.9051731Z"}}]}' - headers: - cache-control: - - no-cache - content-length: - - '1985' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:37 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) + - AZURECLI/2.36.0 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview - response: - body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' - headers: - cache-control: - - no-cache - content-length: - - '771' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:38 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11998' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview - response: - body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' - headers: - cache-control: - - no-cache - content-length: - - '771' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:40 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest?api-version=2022-03-01-preview - response: - body: - string: '{"properties":{"provisioningState":"Succeeded","zoneRedundant":false,"version":3,"serviceId":"6cd9062ba20843ac97492d47595a0f6c","networkProfile":{"outboundIPs":{"publicIPs":["20.85.155.209","20.85.155.224"]}},"powerState":"Running","fqdn":"cli-unittest.azuremicroservices.io"},"type":"Microsoft.AppPlatform/Spring","sku":{"name":"S0","tier":"Standard"},"location":"eastus","tags":{},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest","name":"cli-unittest","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T04:37:08.3742023Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T04:40:15.4945071Z"}}' - headers: - cache-control: - - no-cache - content-length: - - '771' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:42 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '11999' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - Content-Length: - - '0' - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: POST - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/getResourceUploadUrl?api-version=2022-03-01-preview - response: - body: - string: '{"relativePath":"resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903","uploadUrl":"https://0ceb2111a7684e3db339ef7d.file.core.windows.net/6cd9062ba20843ac97492d47595a0f6c/resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903?1234567"}' - headers: - cache-control: - - no-cache - content-length: - - '475' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:44 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-writes: - - '1198' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) - x-ms-content-length: - - '11' - x-ms-date: - - Thu, 24 Feb 2022 08:13:45 GMT - x-ms-file-attributes: - - Archive - x-ms-file-creation-time: - - '2022-02-24T08:13:45.3810360Z' - x-ms-file-last-write-time: - - '2022-02-24T08:13:45.3810360Z' - x-ms-file-permission: - - Inherit - x-ms-type: - - file - x-ms-version: - - '2019-02-02' - method: PUT - uri: https://0ceb2111a7684e3db339ef7d.file.core.windows.net/6cd9062ba20843ac97492d47595a0f6c/resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903?1234567 - response: - body: - string: '' - headers: - content-length: - - '0' - date: - - Thu, 24 Feb 2022 08:13:46 GMT - etag: - - '"0x8D9F76D93DC26B8"' - last-modified: - - Thu, 24 Feb 2022 08:13:45 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - x-ms-file-attributes: - - Archive - x-ms-file-change-time: - - '2022-02-24T08:13:45.3810360Z' - x-ms-file-creation-time: - - '2022-02-24T08:13:45.3810360Z' - x-ms-file-id: - - '11529285414812647424' - x-ms-file-last-write-time: - - '2022-02-24T08:13:45.3810360Z' - x-ms-file-parent-id: - - '13835128424026341376' - x-ms-file-permission-key: - - 5014305482025877591*17093003390299908313 - x-ms-request-server-encrypted: - - 'true' - x-ms-version: - - '2019-02-02' - status: - code: 201 - message: Created -- request: - body: "fake-text\r\n" - headers: - Connection: - - keep-alive - Content-Length: - - '11' - User-Agent: - - Azure-Storage/1.4.2-2.1.0 (Python CPython 3.8.3; Windows 10) - x-ms-date: - - Thu, 24 Feb 2022 08:13:48 GMT - x-ms-range: - - bytes=0-10 - x-ms-version: - - '2019-02-02' - x-ms-write: - - update - method: PUT - uri: https://0ceb2111a7684e3db339ef7d.file.core.windows.net/6cd9062ba20843ac97492d47595a0f6c/resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903?comp=range&1234567 - response: - body: - string: '' - headers: - content-length: - - '0' - content-md5: - - 99EB7GGDEcq+ZSyODG3erA== - date: - - Thu, 24 Feb 2022 08:13:48 GMT - etag: - - '"0x8D9F76D95FCAEEE"' - last-modified: - - Thu, 24 Feb 2022 08:13:48 GMT - server: - - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-server-encrypted: - - 'true' - x-ms-version: - - '2019-02-02' - status: - code: 201 - message: Created -- request: - body: '{"properties": {"source": {"type": "Jar", "relativePath": "resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903", - "runtimeVersion": "Java_8"}, "deploymentSettings": {"resourceRequests": {"cpu": - "1", "memory": "1Gi"}}}, "sku": {"name": "S0", "tier": "Standard", "capacity": - 1}}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - Content-Length: - - '346' - Content-Type: - - application/json - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: PUT uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-05-01-preview response: body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Updating","status":"Running","active":true,"instances":null},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:13:49.2620106Z"}}' - headers: - azure-asyncoperation: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/f8a3deed-cf79-45ec-bb65-cb847efed704?api-version=2022-01-01-preview - cache-control: - - no-cache - content-length: - - '913' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:13:49 GMT - expires: - - '-1' - location: - - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationResults/f8a3deed-cf79-45ec-bb65-cb847efed704/Spring/default?api-version=2022-01-01-preview - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - x-content-type-options: - - nosniff - x-ms-ratelimit-remaining-subscription-resource-requests: - - '1199' - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 202 - message: Accepted -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/f8a3deed-cf79-45ec-bb65-cb847efed704?api-version=2022-01-01-preview - response: - body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/f8a3deed-cf79-45ec-bb65-cb847efed704","name":"f8a3deed-cf79-45ec-bb65-cb847efed704","status":"Running","startTime":"2022-02-24T08:13:50.0252744Z"}' - headers: - cache-control: - - no-cache - content-length: - - '308' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:14:19 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/f8a3deed-cf79-45ec-bb65-cb847efed704?api-version=2022-01-01-preview - response: - body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/f8a3deed-cf79-45ec-bb65-cb847efed704","name":"f8a3deed-cf79-45ec-bb65-cb847efed704","status":"Running","startTime":"2022-02-24T08:13:50.0252744Z"}' - headers: - cache-control: - - no-cache - content-length: - - '308' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:14:30 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deploy - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --artifact-path - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/f8a3deed-cf79-45ec-bb65-cb847efed704?api-version=2022-01-01-preview - response: - body: - string: '{"id":"subscriptions/d51e3ffe-6b84-49cd-b426-0dc4ec660356/resourceGroups/cli/providers/Microsoft.AppPlatform/locations/eastus/operationStatus/default/operationId/f8a3deed-cf79-45ec-bb65-cb847efed704","name":"f8a3deed-cf79-45ec-bb65-cb847efed704","status":"Failed","startTime":"2022-02-24T08:13:50.0252744Z","endTime":"2022-02-24T08:14:34.1564029Z","error":{"code":"BadRequest","message":"112404: - Failed to wait for deployment instances to be ready. Please check the application - log (see https://aka.ms/azure-spring-doc-log ), and try again later."}}' - headers: - cache-control: - - no-cache - content-length: - - '555' - content-type: - - application/json; charset=utf-8 - date: - - Thu, 24 Feb 2022 08:14:41 GMT - expires: - - '-1' - pragma: - - no-cache - request-context: - - appId=cid-v1:797d7e4e-8180-497e-a254-780fbd39ba4d - server: - - nginx/1.17.7 - strict-transport-security: - - max-age=31536000; includeSubDomains - transfer-encoding: - - chunked - vary: - - Accept-Encoding,Accept-Encoding - x-content-type-options: - - nosniff - x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - CommandName: - - spring app deployment show - Connection: - - keep-alive - ParameterSetName: - - -g -s -n --app - User-Agent: - - AZURECLI/2.33.1 azsdk-python-mgmt-appplatform/6.1.0 Python/3.8.3 (Windows-10-10.0.19041-SP0) - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/mock-deployment?api-version=2022-01-01-preview - response: - body: - string: '{"properties":{"source":{"type":"Jar","relativePath":"resources/5a84fe31320ed80c98e92477f218dabb4f9a607ace9933e280a502f626ec89cf-2022022408-475616c7-8c3f-42af-af24-5f8ab8e54903","runtimeVersion":"Java_8"},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null},"provisioningState":"Failed","status":"Running","active":true,"instances":[{"name":"test-container-default-14-7f49c9b4cf-zk4f6","status":"Failed","reason":"Fail - to start, check the console log for this instance","discoveryStatus":"DOWN","startTime":"2022-02-24T08:14:04Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/default","name":"default","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-02-24T08:10:55.1167761Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-02-24T08:13:49.2620106Z"}}' + string: '{"properties":{"source":{"type":"Container","customContainer":{"containerImage":"springio/gs-spring-boot-docker","server":"docker.io"}},"deploymentSettings":{"resourceRequests":{"cpu":"1","memory":"1Gi"},"environmentVariables":null,"terminationGracePeriodSeconds":0,"livenessProbe":{"disableProbe":false,"failureThreshold":24,"initialDelaySeconds":60,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}},"readinessProbe":{"disableProbe":false,"failureThreshold":3,"initialDelaySeconds":0,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1,"probeAction":{"type":"TCPSocketAction"}}},"provisioningState":"Succeeded","status":"Running","active":false,"instances":[{"name":"test-container-green-14-775674d868-5zgbd","status":"Running","discoveryStatus":"N/A","startTime":"2022-05-20T08:59:15Z"}]},"type":"Microsoft.AppPlatform/Spring/apps/deployments","sku":{"name":"S0","tier":"Standard","capacity":1},"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli/providers/Microsoft.AppPlatform/Spring/cli-unittest/apps/test-container/deployments/green","name":"green","systemData":{"createdBy":"qingyliu@microsoft.com","createdByType":"User","createdAt":"2022-05-20T08:59:09.8559209Z","lastModifiedBy":"qingyliu@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2022-05-20T08:59:09.8559209Z"}}' headers: cache-control: - no-cache content-length: - - '1106' + - '1374' content-type: - application/json; charset=utf-8 date: - - Thu, 24 Feb 2022 08:14:46 GMT + - Fri, 20 May 2022 08:59:55 GMT expires: - '-1' pragma: @@ -2350,7 +1354,7 @@ interactions: x-ms-ratelimit-remaining-subscription-resource-requests: - '11998' x-rp-server-mvid: - - ebc692a4-c2cd-44f5-bba2-1b5e5f04cb14 + - 5e115b18-fadf-4457-94d9-ae330a47aa6b status: code: 200 message: OK diff --git a/src/spring/azext_spring/tests/latest/test_asa_scenario.py b/src/spring/azext_spring/tests/latest/test_asa_scenario.py index 80b724e7634..d50f06f17ae 100644 --- a/src/spring/azext_spring/tests/latest/test_asa_scenario.py +++ b/src/spring/azext_spring/tests/latest/test_asa_scenario.py @@ -215,15 +215,6 @@ def test_app_deploy_container(self): ]) self.cmd('spring app deployment create -g {resourceGroup} -s {serviceName} --app {app} -n green' - + ' --container-image {containerImage} --registry-username PLACEHOLDER --registry-password PLACEHOLDER', checks=[ + + ' --container-image {containerImage}', checks=[ self.check('name', 'green'), ]) - - with self.assertRaisesRegexp(CLIError, "Failed to wait for deployment instances to be ready"): - self.cmd('spring app deploy -g {resourceGroup} -s {serviceName} -n {app} --artifact-path {file}') - - self.cmd('spring app deployment show -g {resourceGroup} -s {serviceName} -n default --app {app} ', checks=[ - self.check('name', 'default'), - self.check('properties.source.type', 'Jar'), - self.check('properties.source.runtimeVersion', 'Java_8'), - ]) From c62baec078a699f1222fdf134c89410e456b3e32 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Fri, 20 May 2022 17:11:31 +0800 Subject: [PATCH 19/21] fix test --- src/spring/azext_spring/tests/latest/test_asa_scenario.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spring/azext_spring/tests/latest/test_asa_scenario.py b/src/spring/azext_spring/tests/latest/test_asa_scenario.py index d50f06f17ae..5f64362adda 100644 --- a/src/spring/azext_spring/tests/latest/test_asa_scenario.py +++ b/src/spring/azext_spring/tests/latest/test_asa_scenario.py @@ -215,6 +215,6 @@ def test_app_deploy_container(self): ]) self.cmd('spring app deployment create -g {resourceGroup} -s {serviceName} --app {app} -n green' - + ' --container-image {containerImage}', checks=[ + + ' --container-image {containerImage} --registry-username PLACEHOLDER --registry-password PLACEHOLDER', checks=[ self.check('name', 'green'), ]) From ea3207b1903734c5e571dcc22230850d0037bdaf Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Mon, 23 May 2022 12:16:29 +0800 Subject: [PATCH 20/21] add test --- .../azext_spring_cloud/tests/latest/test_asc_app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py index 68191d4ead4..0c1035baac0 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py @@ -315,9 +315,12 @@ def test_app_deploy_enterprise(self, file_mock): def test_app_deploy_build_enterprise(self, file_mock): file_mock.return_value = mock.MagicMock() deployment=self._get_deployment() - self._execute('rg', 'asc', 'app', deployment=deployment, artifact_path='my-path', build_env={'BP_JVM_VERSION': '8.*'}) + self._execute('rg', 'asc', 'app', deployment=deployment, artifact_path='my-path', + build_env={'BP_JVM_VERSION': '8.*'}, build_cpu='2', build_memory='4Gi') resource = self.put_build_resource self.assertEqual({"BP_JVM_VERSION": "8.*"}, resource.properties.env) + self.assertEqual('2', resource.properties.resource_requests.cpu) + self.assertEqual('4Gi', resource.properties.resource_requests.memory) @mock.patch('azext_spring_cloud._deployment_uploadable_factory.FolderUpload.upload_and_build') def test_app_deploy_folder_enterprise(self, file_mock): From 53f3fb83a3434ab0aaef57ab59c535c39dffa361 Mon Sep 17 00:00:00 2001 From: Qingyi Liu Date: Mon, 23 May 2022 12:31:44 +0800 Subject: [PATCH 21/21] fix test --- .../azext_spring_cloud/tests/latest/test_asc_app.py | 5 +---- src/spring/azext_spring/tests/latest/test_asa_app.py | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py index 0c1035baac0..68191d4ead4 100644 --- a/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py +++ b/src/spring-cloud/azext_spring_cloud/tests/latest/test_asc_app.py @@ -315,12 +315,9 @@ def test_app_deploy_enterprise(self, file_mock): def test_app_deploy_build_enterprise(self, file_mock): file_mock.return_value = mock.MagicMock() deployment=self._get_deployment() - self._execute('rg', 'asc', 'app', deployment=deployment, artifact_path='my-path', - build_env={'BP_JVM_VERSION': '8.*'}, build_cpu='2', build_memory='4Gi') + self._execute('rg', 'asc', 'app', deployment=deployment, artifact_path='my-path', build_env={'BP_JVM_VERSION': '8.*'}) resource = self.put_build_resource self.assertEqual({"BP_JVM_VERSION": "8.*"}, resource.properties.env) - self.assertEqual('2', resource.properties.resource_requests.cpu) - self.assertEqual('4Gi', resource.properties.resource_requests.memory) @mock.patch('azext_spring_cloud._deployment_uploadable_factory.FolderUpload.upload_and_build') def test_app_deploy_folder_enterprise(self, file_mock): diff --git a/src/spring/azext_spring/tests/latest/test_asa_app.py b/src/spring/azext_spring/tests/latest/test_asa_app.py index f2062228f46..f08e0ec00cb 100644 --- a/src/spring/azext_spring/tests/latest/test_asa_app.py +++ b/src/spring/azext_spring/tests/latest/test_asa_app.py @@ -315,9 +315,12 @@ def test_app_deploy_enterprise(self, file_mock): def test_app_deploy_build_enterprise(self, file_mock): file_mock.return_value = mock.MagicMock() deployment=self._get_deployment() - self._execute('rg', 'asc', 'app', deployment=deployment, artifact_path='my-path', build_env={'BP_JVM_VERSION': '8.*'}) + self._execute('rg', 'asc', 'app', deployment=deployment, artifact_path='my-path', + build_env={'BP_JVM_VERSION': '8.*'}, build_cpu='2', build_memory='4Gi') resource = self.put_build_resource self.assertEqual({"BP_JVM_VERSION": "8.*"}, resource.properties.env) + self.assertEqual('2', resource.properties.resource_requests.cpu) + self.assertEqual('4Gi', resource.properties.resource_requests.memory) @mock.patch('azext_spring._deployment_uploadable_factory.FolderUpload.upload_and_build') def test_app_deploy_folder_enterprise(self, file_mock):